Using Kernel Mode Performance Counters
Kernel-mode PCW is an extension to the existing performance counter version 2 platform, which allows kernel-mode components to easily expose performance counters. To incorporate this new extension, you need to make minimal additions to the manifest that describes version 2 counters, and you need to use the kernel-mode performance counter interface.
Use the following steps to develop new counters:
Write a manifest that describes the provider and its counter sets.
For more information about the elements and attributes in the manifest, see Performance Counters Schema. The counter manifest is an XML-format file that defines the performance counter provider and its counter sets.
The manifest can be created manually or created by using the manifest generator tool, Ecmangen.exe. The tool is included in the WDK and is available in a build environment window (type ecmangen at the command prompt).
Use the CTRPP tool to generate the registration code and string resources from the manifest.
The Counter Preprocessor (CTRPP) tool is included in the WDK and is available in a build environment window (type ctrpp at the command prompt).
Add code to register and unregister the counter sets.
Add code to expose the instances.
Build a binary that contains the new code and the string resources.