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

Using the PDH Functions to Consume Counter Data

· 52CE 我爱测

You use the PDH functions to collect performance data.

Use the PDH functions to collect performance data. The PDH functions are easier to use than the registry functions and can be used to access counter data both V1 and V2 providers. PDH has APIs for collecting current performance data, saving performance data to log files, and reading data from log files.

Note: You cannot use the Performance Data Helper abstraction-layer functions if you are writing Windows OneCore apps. Instead, use PerfLib V2 Consumer functions.

PDH is a high-level API that simplifies collecting performance counter data. It helps with query parsing, metadata caching, matching up instances between samples, computing formatted values from raw values, reading data from log files, and saving data to log files. PDH automatically uses the registry functions when collecting data from V1 providers and it uses the V2 Consumer functions when collecting data from V2 providers.

To collect performance data using the PDH functions, perform the following steps.

  1. Create a query
  2. Add counters to the query
  3. Collect the performance data
  4. Display the performance data
  5. Close the query

You can collect performance data from either real-time sources or log files. For more information on how to write performance data to log files, see Working with Log Files.

See also

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)

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

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