Ok I think I found out why you are getting more than 10 metrics.
It is because the top 10 are not constant. I watched my system and ran a few different processes and I noticed the # of metrics climbing. I also set this to run every minute to force metrics quicker.
It is indeed showing you the top 10, however if you start Program A and A breaks into that top 10, that would be the 11th metric shown in the Investigator, displacing one of the others as a top 10. Also if you expand some of the folders (perl for example, you will see different pid's showing up. So while the perl process is the same one, under perl you may see pid1234, pid1235, etc.... for each new one that shows up.
So this custom script would need to be tweaked to prevent this from happening.