windows 监控单个程序的 CPU 和磁盘利用率

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2475341/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:09:20  来源:igfitidea点击:

Monitoring CPU and disk utilization of a single program

c++cwindowsmonitoring

提问by sandeep manglani

How can I calculate CPU and disk utilization of another concurrent program? I.e. one program is running and other calculates the first's resource use.

如何计算另一个并发程序的 CPU 和磁盘利用率?即一个程序正在运行,另一个计算第一个的资源使用。

I'm using C and C++ and running under Windows XP.

我正在使用 C 和 C++ 并在 Windows XP 下运行。

回答by Suma

It is possible, as Process Explorer can do it, but I think you will have to use some kind of undocumented Windows API. PSAPI comes somewhat close, but it gives you only the memory usage information, not CPU or disk utilization.

这是可能的,因为 Process Explorer 可以做到,但我认为您将不得不使用某种未记录的 Windows API。PSAPI 有点接近,但它只为您提供内存使用信息,而不是 CPU 或磁盘使用率。