在C程序中获取内存和CPU使用率

编程入门 行业动态 更新时间:2024-10-27 16:37:21
本文介绍了在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使用率

本文发布于:2023-11-16 16:49:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606090.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:使用率   内存   程序   CPU

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!