(批次)"wmic cpu"多核系统的问题 [英] (Batch) "wmic cpu" issue with multi-core system

查看:119
本文介绍了(批次)"wmic cpu"多核系统的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在具有2个逻辑CPU内核的虚拟机上运行"wmic cpu get loadpercentage/every:1"命令,并且仅获得第1个内核的LoadPercentage,如所附图像所示:多核问题

I run the "wmic cpu get loadpercentage /every:1" command on a virtual machine with 2 logical CPU cores and I get the LoadPercentage of the 1st core only, as you can see on the image attached: Multicore Issue

如何获得实际" CPU利用率(即2个内核的平均使用量)?

How can I get the "real" CPU utilization (i.e. the average use of the 2 cores)?

否则,我如何也可以分别读取第二个CPU使用情况?

Otherwise, how can I also read the 2nd CPU usage separately?

谢谢

推荐答案

我回答我的问题可能很有趣,但是由于我进行了大量搜索和测试,因此我想再分享一个选择:

It is probably funny that I give an answer to MY question, but since I searched and tested a lot, I want to share one more option:

我使用了"typeperf",发现结果确实接近任务管理器的CPU利用率.

I used the "typeperf" and I found the result really close to the task manager CPU utilization.

用于控制台的命令是:

typeperf "\Processor Information(_Total)\% Processor Utility"

或下面的一个批处理文件:

or the one below for a batch file:

typeperf "\Processor Information(_Total)\%% Processor Utility"

不好的地方是:

1)输出格式不是很方便(例如"01/29/2019 21:24:26.000","8.650791")

1) The output format is not very handy (e.g. "01/29/2019 21:24:26.000","8.650791" )

2)如果CPU利用率为100%,则输出为> 100(基本上〜120)

2) If the CPU utilization is 100%, the output is >100 (Basically ~120)

3)如果CPU利用率为1-2%,则输出为〜0.5(基本为<1.5)

3) If the CPU utilization is 1-2%, the output is ~0.5 (Basically <1.5)

这篇关于(批次)"wmic cpu"多核系统的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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