Welcome to MSDN Blogs Sign in | Join | Help

Hyper-V: Clocks lie... which performance counters can you trust?

Many people have asked me how to do performance analysis using Hyper-V.  The first thing I always tell them is clocks lie.  Lets dig into this a little bit.

First some basic concepts.  There are two types of partitions that the Hypervisor manages.  The root partition which is special (manages physical devices, child partitions, … all except CPU and physical memory access which is the Hypervisors job) and the child partitions.  The child partitions are where the “Guest” virtual machines run.  The root partition has the “Root OS” or sometimes called “Host OS” (not technically correct in Hypervisor architectures).

Neither the Root nor the Guests VM’s control the PM Timer, APIC, … which means their concept of time in virtualized.  Something else to be aware of is both the Root and Guest virtual processors share the physical processors in a Round Robin like fashion.

Now let’s take a very important Windows Performance Counter - % Processor Time.  This performance counters details the total amount of CPU being used by a process, … (aka the CPU is not idling waiting for work).  There are other % Processor Time counters for that detail process time on a CPU like Internet Explorer running.

Now for the lie. Check the picture below.  On the guest I am running a CPU spinner program to make it 100% busy.  You can see perfmon running in the guest shows 100% utilization and the root shows ~85% utilization using the Hyper-V Hypervisor Guest Run Time counters.

clockslie

So which is correct?  Actually they both are.  The guest is using 100% of the CPU it has been given by the Hypervisor and each time the guest it running the CPU is busy running the spinner code.  Thus the guest is using 100% or a Virtual CPU.

The Hyper-V Hypervisor Logical Processor counters are showing Logical (aka Physical) Processor utilization.  This is what you are used to % Processor Time actually showing.

So if you are doing performance analysis and using performance counters be aware the counters in the Guest Virtual Machine “lie” so to speak.  What you need to use are the Hyper-V Hypervisor Performance Counters in the Root to get Physical Processor usage.

 

 

Published Thursday, March 20, 2008 12:00 PM by tvoellm
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Hyper-V: Clocks lie... which performance counters can you trust?

Friday, March 28, 2008 5:22 PM by Mihir Patel

Hi Tony,

Is MS planning to publish more details about Hyper-V perfmon counters?  And how to compare virtual performance counters vs. native/parent/root performance counters.

Thanks,

Mihir

# Hyper-V Performance Counters – Part three of many – “Hyper-V Logical Processors” counter set

Friday, May 09, 2008 3:52 AM by ALL TOPICS PERFORMANCE

This is one of the most important counter set in all of Hyper-V. It is also the only counter set that

# Hyper-V Performance Counters – Part four of many – “Hyper-V Hypervisor Virtual Processor” and “Hyper-V Hypervisor Root Virtual Processor” counter set

Monday, May 12, 2008 12:32 AM by ALL TOPICS PERFORMANCE

The “Hyper-V Hypervisor Virtual Processor” and “Hyper-V Hypervisor Root Virtual Processor” counter sets

# re: Hyper-V: Clocks lie... which performance counters can you trust?

Friday, June 06, 2008 2:55 AM by Abhaye

Major concern in this regards, whether both 32/64 bit perfmon application shows these counter sets of Hyper-V

Hyper-V Hypervisor Virtual Processor

Hyper-V Hypervisor Root Virtual Processor

Location of perfmon application for both the environment

C:\Windows\System32 perfmon.exe

C:\Windows\SysWOW64 perfmon.exe

 [Tony's Reply]  Not sure I understand the question.  WS08 Hyper-V host is always 64bit.  The guests can be 32/64 bit.  The perfcounters in the root report on all guests.

# Hyper-V Performance Counters – Part three of many – “Hyper-V Hypervisor Logical Processors” counter set

Wednesday, June 18, 2008 8:36 PM by Virtualization News & Views

This is one of the most important counter set in all of Hyper-V. It is also one of the few counter sets

# Hyper-V Performance FAQ

Thursday, June 19, 2008 3:26 PM by ALL TOPICS PERFORMANCE

Hyper-V Performance FAQ Anthony F Voellm (aka Tony) 6/19/2008 http://blogs.msdn.com/tvoellm Q: What is

# Monitoring Hyper-V Performance

Thursday, April 23, 2009 1:51 AM by ALL TOPICS PERFORMANCE

Now that Hyper-V has been in the market for over 9 months a common question that has come my way is “what

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker