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

This is one of the most important counter set in all of Hyper-V. It is also one of the few counter sets that is not impacted by clock skew (https://blogs.msdn.com/tvoellm/archive/2008/03/20/hyper-v-clocks-lie.aspx)

Before digging into the counter set it is important to understand a Logical Processor (LP) is the number is a cores / HT that the hypervisor is managing. If you have a dual proc quad core without HT you will have 8 LP. If you also had HT you would have 16LP.

There are a set of counters for each LP in the system. Perfmon.exe will let you view the counters for each LP separately or an average for all LP called “_Total”.

Hyper-V Hypervisor Logical Processor counters

· %Guest Run Time – This is the percentage of time guest code is running on an LP or for the _Total the average percentage across all LP. For example if you have 2LP and one VM running CPU tests you might see the value be 95% for LP(0), 0% for LP(1) and 47.5% for the _Total. For this you can see you VM is running on LP(0).

· %Hypervisor Run Time – This is the percentage of time the Hypervisor is running on an LP or for _Total the average percentage across all LP. This is similar to % Kernel Run Time in the Processor counter set.

· %Idle Run Time – This is the percentage of time the LP is waiting for work for _Total the average percentage across all LP. This is similar to % Kernel Run Time in the Processor counter set.

· %Total Run Time – This is just a sum of %Guest Run Time + % Hypervisor Runtime. This counter can go over 100% just slightly (<0.5%). The problem has to do with how performance counters are computed. If you take the current time then value1 and later the end time and value2 this means value2 has the potential to increase between when end time was read and value2 is read. You would change it to get the start time then value1 and later value2 and end time. In this case the number would always be slightly less than 100.

· %C1 Time – C1 is a power saving mode in a CPU. This counter keeps track of how often the process is able to enter a power saving state when idle. So %C1 Time is the percentage of time the LP is in the C1 state and for _Total the average percentage across all LP. If you want to know more about C state and other power modes in windows check out - Processor Power Management in Windows Vista and Windows Server 2008

· %C2 Time – Similar to %C1 Time. C2 is a deeper power state than C1.

· %C3 Time – Similar to %C1 Time. C3 is a deeper power state than C2.

· C1 Transitions / Sec – The is the number of times the LP has entered the C1 state in one second or for _Total the number of C1 transitions across all LP.

· C2 Transitions / Sec – Similar to C1 Transitions / Sec. C2 is a deeper power state than C1.

· C3 Transitions / Sec – Similar to C1 Transitions / Sec. C3 is a deeper power state than C2.

· Hardware Interrupts / Sec – Number of hardware interrupts per second the LP is processing. _Total is the total for all LP. Hardware interrupts are delivered to the root VP’s corresponding the LP on which it was received. For example a network card will create and interrupt when a packet is received.

· Total interrupts / sec – Total number of interrupts of all kinds the LP is processing. For _Total this is the total number of interrupts happening on the system per second.

· Monitor Transition Cost – This is a measure of the cost to enter the Hypervisor via an Intercept on a Logical Processor (LP). For _Total it is the total cost across all processors. Intercepts are like User mode to Kernel Mode context switches except here is User/Kernel Mode to Virtual Machine Monitor (VMM) aka Hypervisor mode. The smaller this value the better. The only real use it has is to figure out the relative performance of processors.

· Context Switches / sec – These are the number of times a new Virtual Processor (VP) had been scheduled to a particular Logical Processor (LP). For _Total it is the total number of VP to LP switches. Ideal time context switches of around 1000 for a single guest running are not uncommon. This is due to the fact the VP will “Halt” and allow something else to run if it has no work to do.

· Scheduler Interrupts / sec – These interrupts are sent by the Hypervisor scheduler from one Logical Processor (LP) to another to reevaluate their runlist. The runlist is the list of Virtual Processors (VP) waiting to run on a given LP. This is also a “wake-up” mechanism for an LP that might be sitting idle in a lower power state. _Total is the total number of scheduler interrupts happen per second across all LPs.

· Inter-processor interrupts sent /sec – These interrupts are from one processor to another to get the processor to do memory coherency (like TLB, cache, …). High counts > 20ish per Logical Processor (LP) can indicate lots of guest pages modification (like page access). _Total is the total number of Inter-processor interrupts (IPIs) set per second.

· Inter-processor interrupts /sec – This counters is the total number of Inter-processor interrupts (IPI)received per second of a give Logical Processor (LP). _Total is the total number of IPI’s received by all LP.

· Timer interrupts / sec – There are a number of timers that the Hypervisor supports – APIC timer, PM Timer, … This is the number of times an LP is interrupted to service a timer interrupt. )