问题
I am using following WMI query to get the CPU load percent data.
Select * from win32_processor and below instance results are captured.
Win32_processor WMI query results
By above data it’s understood that there are two physical processor instances are available (CPU0 and CPU1).
But it’s observed in some machines the load percent parameter for these instances always gives value as 100 and Microsoft has recommended to use the following WMI class to rectify this. So for the same machine below WMI query is made.
Select * from Win32_PerfFormattedData_Counters_ProcessorInformation and results are captured as below.
Win32_PerfFormattedData_Counters_ProcessorInformation WMI query results
In the above results from the same machine, win32_Processor class gives two instances and win32_PerfFormattedData_Counters_ProcessorInformation gives one instance (other data like 0.0, 0.1, 0.2,0.3 are for the cores and not the processor instances).
I was assuming that it’ll give 0,_Total and 1,_Total as the processor instances. _Total is over all load percentage across all the processors.
Note: The above results are based on the VM machine. Don’t have physical machine with two physical processor to verify. But my assumption is since wi32_processor class is giving the data for two physical processor instances, so as win32_PerfFormattedData_Counters_ProcessorInformation should give the data for two physical processor instances.
Please let me know how to get the individual processor information using win32_PerfFormattedData_Counters_ProcessorInformation as win32_Processor gives wrong values. My requirement is to collect overall CPU and individual processor instance CPU load percent data.
来源:https://stackoverflow.com/questions/61956471/cpu-load-percentage-for-individual-processors