Platform SDK: Performance Monitoring

The HKEY_PERFORMANCE_DATA Key

The performance data is accessed through the registry key HKEY_PEFORMANCE_DATA. Each software component creates keys for its objects and counters when it is installed and writes counter data while it is executing. You can access this data as you would access any other registry data, using the registry functions. However, although you use the registry to collect performance data, the data is not stored in the registry database. Instead, calling the registry functions with the HKEY_PEFORMANCE_DATA key causes the system to collect the data from the appropriate system object managers.

To obtain performance data from the local system, use the RegQueryValueEx function, with the HKEY_PERFORMANCE_DATA key. The first call opens the key; you do not need to explicitly open the key first. However, be sure to use the RegCloseKey function to close the handle to the key when you are finished obtaining performance data. The user cannot install or remove a software component while its performance data is in use.

To obtain performance data from a remote system, you must use the RegConnectRegistry function, with the computer name of the remote system and the HKEY_PERFORMANCE_DATA key. This call retrieves a key representing the performance data for the remote system. To retrieve the data, call RegQueryValueEx using this key, rather than the HKEY_PERFORMANCE_DATA key.