Patent ID: 8209681

Claim:
A method of sampling hardware events in a computer system comprising the steps of: a virtual machine identifying a profiling event and a count value to a virtual machine monitor wherein the virtual machine is an initiator virtual machine; and the virtual machine monitor iteratively: programming a hardware event counter with the count value for the profiling event; upon receiving a non-maskable interrupt from the hardware event counter, saving a sample that comprises an event identifier that identifies the profiling event, a code-in-execution identifier that identifies an operating mode or a particular code that is executing when the count value is reached, and a program counter that identifies a next instruction associated with the profiling event to be executed by a processor; determining, by decrementing the program counter, the next instruction of the profiling event; saving a modified sample in response to the determination; and notifying a recipient virtual machine that the sample and the modified sample are available for retrieval.