PAPITopics:PAPI on KVM
KVM provides a virtual PMU (Performance Measurement Unit) to guest operating systems, given your system meets the requirements below.
Support for performance counters inside KVM guests was introduced by a patch incorporated into the 3.3 Linux Kernel. PAPITopics:Virtual PAPI Performance as well as PAPITopics:Steal Time on Virtual Machines tests were run in linux kernel 3.6. Your results may vary depending on linux kernel version.
Qemu-kvm 1.2.5 is the earliest known version to support performance counters. Note, not all linux distribution repositories contain a sufficiently up-to-date version of qemu-kvm. Recent versions of Qemu-kvm may be downloaded from the Qemu Download Page.
Virtual PMU support currently exists only for Intel CPUs. Hopefully AMD support will be available soon.
The guest OS must be booted with the -cpu host flag. This ensures that the virtual CPU model replicates the CPU model of the host machine. This is required for supporting performance events.
Pick up a tarball from our download page. Please refer to README.txt and INSTALL.txt in the root directory for instructions on compiling PAPI on your system. Note that no special flags should be required for running on the virtual machine. Proceed with building as if on a bare metal machine.