Performance Monitoring on Windows NT
-
I would like to programmatically monitor objects, via RegQueryValueEx() / HKEY_PERFORMANCE_DATA. After hours trawling through all the documentation I could find on the web, two things are still confusing me: (1) If I want to monitor a particular object, e.g. Processor, how do I know which object number to pass to RegQueryValueEx() ? I could look up the reg value HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\[LANG]\Counter, but then I cannot assume the string "Processor" is unique (what's to stop a 3rd party app registering its own object or counter called "Processor"?) And obviously the object IDs (numbers) themselves will not be the same on every system (so you can't just hardcode them..) What am I missing here? (2) For my own understanding, where in the registry is the information stored that links object IDs to the performance APIs that they relate to? i.e. When you call RegQueryValueEx(HKEY_PERFORMANCE_DATA,..), Windows has to work out which DLL relates to the object number passed .. so where does it look up the:confused: information ? Many thanks, I'm stumped !! Neil Humphreys.
-
I would like to programmatically monitor objects, via RegQueryValueEx() / HKEY_PERFORMANCE_DATA. After hours trawling through all the documentation I could find on the web, two things are still confusing me: (1) If I want to monitor a particular object, e.g. Processor, how do I know which object number to pass to RegQueryValueEx() ? I could look up the reg value HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\[LANG]\Counter, but then I cannot assume the string "Processor" is unique (what's to stop a 3rd party app registering its own object or counter called "Processor"?) And obviously the object IDs (numbers) themselves will not be the same on every system (so you can't just hardcode them..) What am I missing here? (2) For my own understanding, where in the registry is the information stored that links object IDs to the performance APIs that they relate to? i.e. When you call RegQueryValueEx(HKEY_PERFORMANCE_DATA,..), Windows has to work out which DLL relates to the object number passed .. so where does it look up the:confused: information ? Many thanks, I'm stumped !! Neil Humphreys.
You probably shouldn't be going after the registry data directly, instead... Start here: Performance Monitoring or use WMI to query the performance data. (See Windows Management Instrumentation, specifically the section on Monitoring Performance Data.)
Ian Mariano - http://www.ian-space.com/
"We are all wave equations in the information matrix of the universe" - me