Cette page appartient aux archives web de l'EPFL et n'est plus tenue à jour.
This page belongs to EPFL's web archive and is no longer updated.

OProfile + VMware = ?

Recently I had strange problem with OProfile on a VM. OProfile is pretty straightforward, here is an example of operation:


$ opcontrol --event=default

$ opcontrol --vmlinux=/usr/lib/debug/lib/modules/`uname -r`/vmlinux

$ opcontrol --start

(do something, benchmark etc)

$ opcontrol --stop

$ opcontrol --dump

$ opreport -l


You should see a pretty detailed output of where your CPU is spending time.

Back to the problem, running "opcontrol --list-events" gives you all performance counters (events) that the CPU supports. This command works inside a guest OS in vmware (fusion at least) as if it ran on the host OS, great!. Well, unfortunately there is no data coming from them. VMware doesn't support performance counters, and many other special registers for that matter, but it lets you list them anyway. So how can we use oprofile inside vmware ? A: timer interrupt mode.

First unload oprofile kernel module:

$ opcontrol --deinit

Now load it manually but passing an argument:

$ modprobe oprofile timer=1

Now you are good to go !


If opcontrol returns an error "You cannot specify any performance counter events because OProfile is in timer mode", just remove the file ~./oprofile/daemonrc and try again.


NOTE: This was done on a Fedora 10, you should check your distro on how to point to vmlinux.

Posted by Daniel Tralamazza on Wednesday 25 February 2009 at 16:13