C++打印CPU和内存实时使用情况
windows:
使用的库是:pdh.h
Search · CPU memory usage (github.com)
https://github.com/search?l=C%2B%2B&o=desc&q=CPU+memory+usage&s=stars&type=Repositories
Pdh.h header - Win32 apps | Microsoft Docs
https://docs.microsoft.com/zh-cn/windows/win32/api/pdh/打印硬件信息:
C/C++获取操作系统、CPU、内存信息、硬盘、IP和MAC、进程信息(windows和linux)_All In !!!的博客-CSDN博客_c++ 获取处理器信息
https://blog.csdn.net/hwx802746/article/details/114281780打印CPU和内存实时使用信息:
jeffcharles/batarim-utilization-logger: This application will log various utilization statistics (e.g., overall CPU and RAM usage) into a CSV file along with what applications were using the most CPU and RAM at a given time and what window was focused. This CSV file can then be analyzed to determine if there are any problems with resource utilization levels, if any applications are stressing the hardware, or for any other purpose that you would like. (github.com)
https://github.com/jeffcharles/batarim-utilization-loggerScuroGuardiano/ServerUsageMonitor: Server Usage Monitor for Windows. You can see actual usage CPU, RAM and Virtual Memory on the page. (github.com)
https://github.com/ScuroGuardiano/ServerUsageMonitor
结论:与任务管理器对比,CPU不准,内存较准
Linux:
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
