简体   繁体   中英

How to get CPU usage or disk usage of application using Windows API from C++?

How to proceed to get CPU usage or disk usage of application using API in C++???

I want to get the highest CPU usage or disk usage among the application running on windows. I have tried to find out API but there is no direct API for that. Can anyone please let me know how to proceed for this in C++.

You look at the Process category performance counters to get per process CPU/Memory/IO or at respective categories (Processor, Memory, Physical/Logical Disk) counters for overall system performance. The values can be accessed via dedicated APIs or from WMI .

Windows 7 already has this built-in, as part of the Resource Monitor (realmon.exe). If you want to find this in code, you can either use the Perf Counter API or create a Realtime ETW consumer against the NT kernel provider.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM