Search code examples
cpumulticorewmic

(Batch) "wmic cpu" issue with multi-core system


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

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

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

Thank you


Solution

  • 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:

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

    The command for the console is:

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

    or the one below for a batch file:

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

    The bad points are:

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

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

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