Consuming Counter Data
Programs that want to read and make use of Windows Performance Counter data can use one of several interfaces as appropriate for the scenario.
- Scripts can use the WMI Performance Counter Classes or the TypePerf tool.
- .NET programs can use the PerformanceCounter Class.
- The Performance Data Helper (PDH) library provides high-level access to data from both V1 and V2 performance counter providers via a Win32 (C/C++) API.
- The registry interface provides access to data from both V1 and V2 performance counter providers via the special
HKEY_PERFORMANCE_DATA
registry key. - The PerfLib V2 Consumer functions provide low-level access to data from V2 performance counter providers via a Win32 (C/C++) API.
The PDH interface is recommended for most C/C++ performance data collection tasks because it is easier to use than the registry and PerfLib interfaces.