Virtualization of Perf Counters
This page is mostly a placeholder with info gathered while
doing VM perf counter work. It's not meant to be exhaustive,
just notes I want to jot down so I don't forget.
As of Linux 3.3 KVM supports perf counters in the guest.
You also need a recent enough Qemu (as of April 2012 that means
a git snapshot). Aggregate counts are supported, although
overflow interrupts don't seem to be.
I'm using a Debian Unstable disk image. with the command line:
./qemu/bin/qemu-system-x86_64 -cpu host -drive if=virtio,aio=native,file=vmw5.qcow2 -m 512 -nographic --enable-kvm
It works on a core2 machine. On sandybridge I have to boot the
kernel with the "nox2apic" option, as it crashes on boot otherwise.
To get the serial console to work at boot I need to add the following
to the /etc/default/grub file and then run update-grub:
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
GRUB_CMDLINE_LINUX="text console=tty0 console=ttyS0,115200n8"
Xen has work on perf-counters done too.
At one point I had Xenoprof, which was oprofile for Xen, going
on a laptop but I lost the disk image.
Doesn't currently support perf counters in guest, but
the next version might.
You can also use perf counters to measure a guest from
outside, in the host. See the perf tool's "kvm" options
of vmkperf on VMware.
Back to unofficial perf_event pages