在C程序中获取内存和CPU使用率 [英] Get Memory and CPU usage in a C program
本文介绍了在C程序中获取内存和CPU使用率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
晚上好,
我正在编写C程序,需要获取内存信息(大小和使用情况),
我还需要知道CPU使用量.
我们有返回这些结果的函数吗?
谢谢
Good Evening,
I am writing a C program and need to get memory info (Size and Usage),
also I need to know the CPU usage amount.
Do we have functions that returns these results?
Thanks
推荐答案
您可以尝试使用google.我发现此CodeProject文章带有搜索短语"C ++ get cpu load":
通过GetSystemTimes获取CPU使用率 [
You could try google. I found this CodeProject article with the search phrase, "C++ get cpu load":
Get CPU Usage with GetSystemTimes[^]
另一种替代方法是使用性能计数器.这是一个小例子:
Windows C ++通过性能计数器获取CPU和内存利用率 [ ^ ]
还有一位来自CP
性能计数器简介 [
Another alternative is to use performance counters. Here is a small example:
Windows C++ Get CPU and Memory Utilisation With Performance Counters[^]
And one from CP
An Introduction To Performance Counters[^]
Regards
Espen Harlinn
google MEMORYSTATUSEX文档
google MEMORYSTATUSEX for documentation
这篇关于在C程序中获取内存和CPU使用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文