Creating Other Registry Entries

As described in Creating the Application's Performance Key, a component that provides performance counter data must have a Performance key under the Services key, and the Performance key must contain Library, Open, Collect, and Close values. In certain cases, your component may need to configure additional registry values.

Metadata

MetadataGlobal and MetadataCostly are metadata-only queries generated by Windows 10 20H1 and later. They allow a user to obtain metadata (object information and counter information) without performing a potentially-expensive data collection. The metadata-only query is expected to return the same results as the corresponding Global or Costly query except that NumInstances should be set to PERF_METADATA_MULTIPLE_INSTANCES (for a multi-instance object) or PERF_METADATA_NO_INSTANCES (for a single-instance object) and the result should omit all PERF_INSTANCE_DEFINITION blocks.

If your performance DLL supports MetadataGlobal and MetadataCostly query types, it should indicate this by adding a REG_DWORD value Collect Supports Metadata to its Performance key and setting the value to 1. If Collect Supports Metadata is absent or set to 0, a metadata-only query will fall-back to a Global or Costly query.

HKEY_LOCAL_MACHINE
   \SYSTEM
      \CurrentControlSet
         \Services
            \application-name
               \Performance
                  Collect Supports Metadata = 1

Linkage

The performance DLL's OpenPerformanceData function takes a string argument as input. To provide an input string to your open function, include a Linkage key under your Services key. The Linkage key contains an Export value. Set the value data for Export to the input string that you want to pass to your open function. The data type of Export is REG_MULTI_SZ.

If Export is not defined (Export is optional), the system passes NULL to your OpenPerformanceData function.

Typically, if more than one application shares the same performance DLL, each application includes a Linkage key and Export value to provide context as to which application is calling the DLL.

The following shows the registry entries:

HKEY_LOCAL_MACHINE
   \SYSTEM
      \CurrentControlSet
         \Services
            \application-name-1
               \Linkage
                  Export = app-1 context strings
               \Performance
                  Library = perfctrs.dll
            \application-name-2
               \Linkage
                  Export = app-2 context strings
               \Performance
                  Library = perfctrs.dll

Timeout

By default, the performance DLL's OpenPerformanceData and CollectPerformanceData functions must return within 10,000 milliseconds. If not, the system does not use the data that the DLL returns. The application can increase or decrease the timeout value by specifying an Open Timeout or Collect Timeout registry value under their Performance key as shown in the following example.

HKEY_LOCAL_MACHINE
   \SYSTEM
      \CurrentControlSet
         \Services
            \application-name
               \Performance
                  Open Timeout = Timeout value for your open function, in milliseconds
                  Collect Timeout = Timeout value for your collect function, in milliseconds

DOS Devices

To obtain the performance data for some applications (those that return counters using the DeviceIoControl function), it is necessary to use the CreateFile function to open the device associated with the application. In this case, the name specified in CreateFile must also be installed in the DOS Devices node of the registry, as shown here:

HKEY_LOCAL_MACHINE
   \SYSTEM
      \CurrentControlSet
         \Control
            \Session Manager
               \DOS Devices