What's New with Performance Counters

This section describes the new features that were added to Performance Counters for each release.

Windows 10 20H1

If you are reading performance data directly from the registry, you can now perform a metadata-only collection to avoid unnecessary work when making a list of available performance objects and counters. If you use MetadataGlobal instead of Global in your query, all metadata-enabled provider DLLs will skip the data collection step, potentially improving query performance on systems with many processes or threads. Provider DLLs that are not metadata-enabled will continue to work as before.

If you are providing performance data using a performance DLL, you can implement support for metadata-only collection to avoid unnecessary data collection. Update your Collect function to respond to MetadataGlobal and MetadataCostly queries with just the metadata (use PERF_METADATA_NO_INSTANCES or PERF_METADATA_MULTIPLE_INSTANCES for NumInstances and omit all PERF_INSTANCE_DEFINITION blocks from the response), then add a Collect Supports Metadata registry value with REG_DWORD value of 1 to your service's Performance subkey.

Windows 7 and Windows Server 2008 R2

The CTRPP tool was changed to improve and simplify code generation. The tool now generates only a header and resource file. If you want to old code generation behavior (not recommended), you can use the new -legacy argument.

  • You must now specify the new -o and -rc arguments that specify the name and location of the header and resource file, respectively.
  • You can use the optional new -prefix argument to specify a string to add to the beginning of global variables and functions defined in the generated header file.
  • If you have to update your counters manifest, using the new code generation eliminates the need to merge your previous callback implementation with the new generated code since the callbacks are no longer included in the generated code.

A new symbol attribute is available for the following manifest elements:

The symbol attribute is required for provider and counterSet, and is optional for counter. The attribute lets you provide a symbolic name that you can use to reference each element when calling the provider functions (for example, you can use the counter set symbolic name when calling PerfCreateInstance).

Windows Vista

The Performance Counters architecture for providing counter data was completely changed for this release.

Previously, you used an INI file to define your counter data and you implemented a performance DLL which ran in the consumer's process to provide the data when a consumer requested it. This architecture is deprecated and is not recommended for new code due to significant performance and reliability issues.

The new architecture uses a manifest to define the counter data and runs code in the provider's process to provide the data when a consumer requests it. For additional details, see Providing Counter Data Using Version 2.0.

The following functions were added for this release:

The following structures were added for this release:

For a list of the XML elements that you use in your manifest to define your counters, see Performance Counters Schema.

For information on the CTRPP pre-processor tool that parses your manifest and generates the code that you use as the starting point for your provider, see CTRPP.