Hyper-V, Virtual Machine CPU usage and Task Manager

Hyper-V, Virtual Machine CPU usage and Task Manager

Rate This
  • Comments 8

A number of people have asked me about the fact that the CPU usage reported on the Hyper-V Management console does not match the CPU usage reported under task manager.  The answer to this is fairly complicated - so I thought it would make a good blog post.  To set the stage I need a diagram:

Drawing1

The first part of the answer is that when you run Task Manager in the parent partition (remembering that it is "just another partition on the system") it knows nothing about CPU usage that is happening in the hypervisor or in child partitions.  Indeed - I have had systems where the CPU usage was so high that the entire system was starting to get unresponsive - but when I opened task manager in the parent partition it told me that the CPU load was only 30% (which was correct, as the CPU load in the parent partition was only 30%).

The second part of the answer is that it is actually quite hard to come up with a true number that indicates how much CPU is being used by a virtual machine.  The reason for this is that virtual machine CPU usage happens in many places:

  1. The first, and most obvious, place that CPU gets used is inside the child partition.  This is the information that is displayed in the Hyper-V manager.  To get this outside of the Hyper-V Manager open up "perfmon", go to the Performance Monitor and look at the % Guest Run Time counter under the Hyper-V Hypervisor Virtual Processor section.
  2. The next place that CPU is used is actually the time spent in the hypervisor handling intercepts, switching contexts, etc...  To get this information open up "perfmon", go to the Performance Monitor and look at the % Hypervisor Run Time counter under the Hyper-V Hypervisor Virtual Processor section.
  3. The final place that CPU gets used is in the worker process in the parent partition.  Each running virtual machine has a worker process in the parent partition.  This is where code gets run for operations like saving state or snapshotting.  It is also where code gets runs for our emulated devices.

Cheers,
Ben

Leave a Comment
  • Please add 1 and 5 and type the answer here:
  • Post
  • "The first part of the answer is that when you run Task Manager in the parent partition (remembering that it is "just another partition on the system") it knows nothing about CPU usage that is happening in the hypervisor or in child partitions". Is it the same way for RAM? I can clearly see all my 4 GB of RAM on my laptop with Hyper-V. What is the differens between CPU and RAM with parent partition and Hyper-V?

  • This sounds like a bad explenation for a bug. I just hope it doesn't hide a serious design nor archiecture problem in Hyper-V. Time will tell though...

  • Ben,

    Love reading your posts! Thanks for the great info!

    My only question about this explanation of the differences between the two is if it's that complicated and doesn't show the true values in near real-time, then why not use a scale (i.e. Great, Good, OK, Poor, Critical). Just a thought. Perhaps then, it could be more manageable and more reflective. Then, we can pop over and see what threads are causing the Poor rating. Again, just a thought.

    Duncan

  • any good samples regarding WMI,VirtualServer and Visual C++

  • You'll actually find the same case with VMWare.  IMHO, people should not keep looking at Virtual Guests the same as they do as physical machines.  Another item in addition to CPU/Memory is Time, since the processor on a guest is not always active then time can become a problem keeping in true sync which can cause issues with real-time/time sensitive applications.

  • Ben,

    Do you have any suggestions regarding monitoring disk subsystem monitoring? For example if my child guest machines are actually on a SAN, where would be the best place to monitor disk performance for the child?

    Richard

  • Hello:

    Encounter a more difficult problem, my environment is a resource monitoring in the failover cluster in Windows 2008 R2, through sub-partition to complete the partition of this sub?

    If the only monitor in the parent partition, then it would be a very bad problem, because the child partition will drift, unable to confirm the sub-partition in which the parent partition

  • How much of this information has changed in Server 2012 R2 if any? Any new/depricated features in Server 2012 R2 compared to this?

    Thanks

Page 1 of 1 (8 items)