Platform SDK: Performance Monitoring

Adding Performance Counters

Windows NT/Windows 2000 provides a mechanism for you to add performance objects and counters for your application and other software components. Performance counters specific to your application can help you tune performance while you develop and debug the application. After your application is complete and installed on target systems, the counters can help system administrators adjust configurable settings for your application.

To add an extended object and its counters, use the following steps.

  1. Design the object types and counters for the application. See Object and Counter Design.
  2. Create an initialization (.ini) file containing the names and descriptions of the counter objects and counters. See Adding Counter Names and Descriptions to the Registry.
  3. Create a header (.h) file containing the relative offsets at which the counter objects and counters will be installed in the registry. See Adding Counter Names and Descriptions to the Registry.
  4. Set up the necessary performance monitoring entries in the registry. This includes the following steps.
    1. Create a registry key in the Services key for the application. If you do not have such a node, create it under the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services. See Creating the Application's Performance Key.
    2. Use the lodctr utility with the .ini and .h files to install the information in the registry. This utility succeeds only if a performance key exists in the Services key for the application. See Adding Counter Names and Descriptions to the Registry.
  5. Create a performance DLL containing a set of exported functions that provide the link between the application and a performance monitoring application. See Creating the Performance Extension DLL.
  6. Modify the application's setup file to automate adding information to the registry (as described in step 4) and move your performance DLL to the system directory at setup.

To view an extended object, its functions, and its counter, use the extensible counter list utility (Exctrlst.exe). For more information, see ExCtrLst.