Using Kernel Mode Performance Counters
Collapse the table of content
Expand the table of content

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:

  1. 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).

  2. 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).

  3. Add code to register and unregister the counter sets.

    For more information, see the PcwRegister and PcwUnregister functions.

  4. Add code to expose the instances.

  5. Build a binary that contains the new code and the string resources.

For an example of a kernel-mode PCW provider, see the Kernel Counter Sample (Kcs) in the Windows driver samples repository on GitHub.

 

 

Send comments about this topic to Microsoft

Show:
© 2016 Microsoft