如何获取Windows数据(例如CPU使用率等)? [英] How can I get Windows data like CPU usage, etc.?

查看:260
本文介绍了如何获取Windows数据(例如CPU使用率等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得Windows数据,例如CPU使用率,物理内存,网络使用率和带宽,类似于在任务管理器中看到的数据?我正在使用C ++.

How can I get Windows data like CPU usage, physical memory, and network utilization and bandwidth, similar to what I see in Task Manager? I'm using C++.

推荐答案

您可以使用性能数据来获取CPU使用率.如果仅需要一个(或几个进程)数据,则调用 GetProcessTimes 每隔几秒钟.

You can get CPU usage using the performance data. If you want data for only one (or a few processes) it may be simpler to call GetProcessTimes every few seconds.

通常很难确切确定物理内存使用量的含义.除非您这样做,否则尝试描述如何进行测量是毫无意义的.

It's generally difficult to pin down exactly what physical memory usage even means. Until you do, trying to describe how to measure it is pretty pointless.

您可以通过 GetIpStatistics获取有关网络利用率的一些信息. .

You can get some information about network utilization with GetIpStatistics.

您可以使用获取已安装的网络适配器的额定带宽. GetIfTable .

You can get the rated bandwidths of the installed network adapters with GetIfTable.

这篇关于如何获取Windows数据(例如CPU使用率等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆