performance counters

just write whatever you want
Post Reply
ciuly
Posts: 65
Joined: Mon Apr 30, 2007 1:16 pm
Location: Romania

performance counters

Post by ciuly »

Hi madshi,

found your piece of code for cpu utilization here http://www.experts-exchange.com/Program ... 27047.html
where did you get the object number (238) and counter number (6)? I can't seem to be able to find anything on the net (obviously it's pretty hard not knowing what to search for)
I'm trying to get some more info, for memory and network card so I need a list of object and counter numbers and their coresponent names. I did find this on msdn, but no connection to the actual numbers.
Aloo, as I saw somwhere, these numbers are not the same for different win versions. What would be a more correct way fo getting this info? the object and counter name would be a good choice but then again, that's just how I see it.
All I want is a little push in the right direction. it seems I'm just not searching right since i can't find anything realy usefull.

thanks.
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Unfortunately this is SO long ago, I don't remember any dirty details... :?

Maybe some of the other comments in that Experts Exchange question help? It seems there are some functions that can translate names to indexes somehow?
ciuly
Posts: 65
Joined: Mon Apr 30, 2007 1:16 pm
Location: Romania

Post by ciuly »

well, no problem. that's a starting point. I'll look into that. thanks ;)
ciuly
Posts: 65
Joined: Mon Apr 30, 2007 1:16 pm
Location: Romania

Post by ciuly »

found it here
I've implemented a helper unit/function to access performance counters by object and counter name.

thanks for the tip :)
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

So are the numbers/names really different in different OSs?
ciuly
Posts: 65
Joined: Mon Apr 30, 2007 1:16 pm
Location: Romania

Post by ciuly »

dunno :)
this is the article that I read mentioning the differences.

all I did was: get all index-name pairs once at project startup and cache them in a stringlist as "name=index" so I can use cache.values[name] to get the index.
that will work on all systems but not with my current code to get the value since I am using your code where I get the object first and then iterate through the counters. I'll have to document a little on a way to get the counter dirrectly, if that is at all possible.
so if the guy is right, this won't work on all systems. I don't have a way to test it so this will probably be tested by my client :)
Post Reply