Virtualizing Performance Counters for Accurate IPC Measurement

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for profiling software performance in virtualized environments are inaccurate due to the undercounting of instructions-per-cycle (IPC) caused by the continuous running of the time stamp counter (TSC) during non-execution periods, and the inability to accurately differentiate between speculative and non-speculative events, leading to incorrect performance measurements.

Innovation Solution

A hypervisor that virtualizes performance monitoring counters by scheduling virtual machines (VMs) on processor cores, incrementing virtual performance counters for both direct and emulated instructions, and differentiating between speculative and non-speculative events to provide accurate performance metrics.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the time stamp counter (TSC) runs continuously during non-execution periods, then the counter is always available for timing measurements, but the instructions-per-cycle (IPC) measurement becomes inaccurate

Engineering Contradiction:
Improveavailability of TSCVSAvoidIPC measurement accuracy
Core Design Contradiction:
ReliabilityVSMeasurement precision

Solution Approach 1:

The patent segments performance counter measurements into two distinct categories: speculative events (which continue during non-execution) and non-speculative events (which pause during non-execution). This segmentation allows the system to maintain continuous TSC operation while accurately measuring IPC by selectively counting only non-speculative events that correspond to actual instruction execution.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a hypervisor as an intermediary layer between the physical hardware and the virtual machine. The hypervisor virtualizes performance counters to differentiate between speculative and non-speculative events, acting as a mediator that translates continuous hardware counter operations into accurate virtualized performance measurements that account for non-execution periods.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If performance counters are virtualized to differentiate speculative and non-speculative events, then measurement accuracy improves, but system complexity increases

Engineering Contradiction:
Improveperformance measurement accuracyVSAvoidvirtualization system complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent creates virtual copies of performance counters in the virtualized environment that mirror the physical hardware counters. These virtual counters are programmed to emulate the behavior of physical counters while adding the intelligence to differentiate between speculative and non-speculative events, providing accurate measurements without requiring complex modifications to the underlying hardware.

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The patent changes the operational parameters of performance counters by programming them with specific event differentiation logic. The counters are configured to respond differently to various types of events (speculative vs. non-speculative), transforming standard hardware counters into intelligent measurement devices that automatically adjust their counting behavior based on the nature of the event being measured.

Inventive Principle:
Principle #35Parameter changes

3Loss of information

If all performance events are counted continuously, then no measurement information is lost, but speculative events are incorrectly included in performance metrics

Engineering Contradiction:
Improveperformance data completenessVSAvoidperformance metric accuracy
Core Design Contradiction:
Loss of informationVSMeasurement precision

Solution Approach 1:

The patent implements dynamic performance counter behavior where the counting operation changes based on the event type. Counters are programmed to dynamically enable or disable counting for specific event categories (speculative vs. non-speculative), allowing the system to maintain complete event awareness while selectively recording only relevant performance data in different operational contexts.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS10452417B2Methods, apparatus, and articles of manufacture to virtualize performance counters
Publication Date: 2019.10.22 VMWARE INC
  • US10452417B2 patent drawing
  • US10452417B2 patent drawing
  • US10452417B2 patent drawing

AI summary

Methods, apparatus, and articles of manufacture to virtualize performance counters are disclosed. An example method includes dividing performance events to be counted into a plurality of classes; assigning a first virtual performance counter of a virtual machine to a first performance event type in a first one of the classes; assigning a second virtual performance counter of the virtual machine to a second performance event type in a second one of the classes different from the first class; incrementing the first virtual performance counter in response to a first occurrence of the first performance event type during direct execution of guest instructions by the virtual machine; and not incrementing the first virtual performance counter in response to a second occurrence of the first performance event type during execution of emulated instructions by a hypervisor on behalf of the virtual machine.