本文介绍了在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 性能计数器简介 [ ^ ] 问候 Espen Harlinn 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使用率
发布评论