How to programatically get NPU utilization using C/C++/C#

comor 0 Reputation points

如果一台PC有NPU,那么在Windows 11任务管理器中,“性能”页面就会显示NPU的信息(包括使用率),一般来说,这个页面显示的信息从“性能计数器(PDH)”中获取,但是我并没有找到对应的计数器。有谁知道这个NPU使用率从哪儿获取吗?

If a PC has an NPU, then in the Windows 11 Task Manager, the "Performance" page will display the information of the NPU (including the usage rate). Generally speaking, the information displayed on this page is obtained from the "Performance Counter (PDH)", but I have not found the corresponding counter. Does anyone know where this NPU usage rate is obtained from?

User's image

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,488 questions
Windows Performance Toolkit
Windows Performance Toolkit
A collection of Microsoft performance monitoring tools that produce in-depth performance profiles of Windows operating systems and applications.
95 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tong Xu - MSFT 2,116 Reputation points Microsoft Vendor


    Welcome to Microsoft Q&A!

    It gets the perf counter data, and get perf counter then using the physical ID to classify the running time data and do the math. Here is a sample:

    Digging a little deeper, the adapter for the NPU engine here is taken via the DXCore enumeration adapter and then collected and displayed by creating a query and adding counters to it.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments