如何使用 Win32_PerfRawData_Tcpip_NetworkInterface 类获取 C++ 中的当前带宽
我想如何使用 Win32_PerfRawData_Tcpip_NetworkInterface 类来获取当前带宽。 我想从一开始就知道。我正在使用 xp,Microsoft Visual C++ 2005 Express Edition。我不知道如何操作。
I wanted to how to use Win32_PerfRawData_Tcpip_NetworkInterface class to get the current bandwidth.
I want to know from the begining. i'm using xp,Microsoft Visual C++ 2005 Express Edition.I'm not getting how to.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能会发现使用 性能计数器 直接使用 API,而不是通过 WMI。 此处提供了分步说明。
这两个 API 都很复杂,没有简单的方法。
You may find it easier to get the required data using the Performance Counters API directly instead of going through WMI. Step by step instructions are here.
Both APIs are complex, there is no easy way here.
您应该使用 *Win32_PerfFormattedData_Tcpip_NetworkInterface* 来代替,原始计数器需要在使用之前进行处理,这是一项艰巨的任务。
以下属性可能令人感兴趣:
BytesReceivedPerSec、BytesSentPerSec、CurrentBandwidth(用于计算利用率)、BytesTotalPerSec
You should use the *Win32_PerfFormattedData_Tcpip_NetworkInterface* instead, the Raw counter needs to be processed before used and thats a non-trivial task.
The following properties may be of interest:
BytesReceivedPerSec, BytesSentPerSec, CurrentBandwidth ( to calculate utilization) , BytesTotalPerSec