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

Adding Performance Counters

· 52CE 我爱测

Performance counters specific to your application can help you tune performance while you develop and debug the application.

Important: Due to significant performance and reliability limitations, the method for providing performance counter data that this topic describes may be altered or unavailable in the future. Instead, Microsoft recommends that you use the method described in Providing Counter Data Using Version 2.0 for creating new performance counters, and that you migrate existing performance counters to use that method as well.

Performance counters specific to your application can help you tune performance while you develop and debug the application. After your application is complete and installed on target systems, the counters can help system administrators adjust configurable settings for your application.

Adding a performance object and its counters

  1. Design the object types and counters for the application. For details, see Object and Counter Design.
  2. Create an initialization (.ini) file containing the names and descriptions of the performance objects and counters that you provide. For details, see Adding Counter Names and Descriptions to the Registry.
  3. Create a header (.h) file containing the relative offsets at which the counter objects and counters will be installed in the registry. For details, see Adding Counter Names and Descriptions to the Registry.
  4. Set up the necessary performance monitoring entries in the registry. This includes the following steps.
    1. Create a registry key in the Services key for the application. If you do not have such a node, create it under the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services. For details, see Creating the Application's Performance Key.
    2. Use the lodctr utility with the .ini and .h files to install the information in the registry. This utility succeeds only if a performance key exists in the Services key for the application. For details, see Adding Counter Names and Descriptions to the Registry.
  5. Create a performance DLL containing a set of exported functions that provide the queried counter data to the consumer. For details, see Creating a Performance Extension DLL.
  6. Modify the application's setup file to automate adding information to the registry (as described in step 4) and copy your performance DLL to your application's directory at setup.

For information about additional registry entries, see Creating Other Registry Entries.

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)

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

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