Hi! If you’ve used Hyper-V, you might have seen a CPU Usage column inside Hyper-V Management console for each Virtual Machine (VM).
A friend of mine thought this was the CPU usage of that VM, however, when looking at the CPU utilization inside the VM those numbers didn’t match. so, what is this number and how Hyper-V Management console calculates it?
The percentage value displayed in the CPU Usage column for a VM is computed from 3 different sources below;
(1) CPU used when in the virtual machine context.
+ (2) CPU used by the worker process for the virtual machine (for device emulation and what not). This can be seen in vmwp.exe on the Parent Partition. (Note: each running VM has it own vmwp.exe process with VM’s GUID in the startup command line of it. please see the end of this post for more information**)
+ (3) CPU used in the hypervisor switching back and forth and doing other miscellaneous tasks.
CPU Usage Percentage displayed in the Hyper-V Manager
Item (1) Shows up in the MMC SnapIn.
Item (2) Shows up in the parent task manager.
Item (3) Is tracked in Hyper-V performance counters on the parent partition - but you can’t track this ‘per VM’ - but just system wide
Note that it is possible (and quite common) to have virtual machines running the processors hot - but task manager in the parent partition thinks nothing is happening. This is just one side effect of the fact that with Hyper-V the parent partition is really just a special virtual machine. Partitions in Hyper-V are isolated and aren’t aware of other partitions.
There may also be the case where both the CPU Usage displayed in Windows Task Manager inside the VM guest OS is negligible and the CPU Usage displayed in Windows Task Manager on the Host machine is also negligible but the CPU Usage displayed in the Hyper-V Manager is significant (25% or more). This could only be due to the Item (3) CPU Usage resulting from the hypervisor activity that neither the “parent” or “child” partitions have any means of capturing within their own Task Manager counters.
Customers should use Performance Monitor (Perfmon) on the Parent Partition to gather accurate Hyper-V Virtual and Logical Processor information on the VMs in Child Partitions as well as the Parent Partition.
Select the Hyper-V Hypervisor… counters - look at the Instances of the VM in question.
So, If you’re planning to monitor your VMs, you need to do this using Hyper-V counters on the Parent Partition otherwise you’ll be missing some vital data.
**Here’s how to find VMWP.exe process related to specific running VM; (You probably need to add Command Line column from View menu in Task Manager on the Parent Partition)
This GUID matches VM’s configuration file (.xml and other folders associated with that VM);
Hope you find this post helpful. So long!