Platform SDK: Performance Monitoring

Determining a Counter's Name or Index

For each object and counter in the registry, there is a corresponding numeric index. The purpose of a counter index is to facilitate searches for a particular counter name and description. For more information on counter indexes, refer to Retrieving Counter Names and Explanations. For example code that compiles a list of all counter indexes in the registry using the registry interface, refer to Displaying Object, Instance, and Counter Names.

The counter name and index provide two ways to access a particular counter; however, you must know either the name or the index to do so. If you know the index of a counter and want to obtain the name, call the PdhLookupPerfNameByIndex function. If you know the name of a counter and want to find the index, call the PdhLookupPerfIndexByName function.

With both functions, the machine name can be expressed as a DNS name or an IP address, depending on which network protocols you have installed.