大网数据广告活动
性能与资源

Creating Other Registry Entries

· 52CE 我爱测

The performance DLLs OpenPerformanceData function takes a string argument as input.

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

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 07/14/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。