问题
I'm running a Linux Ubuntu 10.4 VM using VirtualBox. I'm trying to use oprofile to profile some application in the virtual machine. I've installed oprofile 0.9.6 but I cannot get it to work. When I try to start I get the following error:
opcontrol --start
/usr/local/bin/opcontrol: line 323: /usr/local/bin/ophelp: cannot execute binary file
/usr/local/bin/opcontrol: line 1483: /usr/local/bin/oprofiled: cannot execute binary file
Couldn't start oprofiled.
Check the log file "/var/lib/oprofile/samples/oprofiled.log" and kernel syslog
As I'm not sure if VirtualBox could provide access to the performance counters (I'm in doubt here so if you have any pointers it would be great) I defaulted oprofile to the timer interrupt like so:
opcontrol --deinit
/usr/local/bin/opcontrol: line 323: /usr/local/bin/ophelp: cannot execute binary file
Unloading oprofile module
root@dev-ubuntu-10:/usr/local/bin# /sbin/modprobe oprofile timer=1
root@dev-ubuntu-10:/usr/local/bin# opcontrol --init
But still not working and I'm getting the same error. Is it even possible to run oprofile in a VM?
Thanks
回答1:
I've tried something similar in the past, only with VMware Fusion and a different profiler, and run into the same problem. It seems that access to the performance registers and other low level stuff that profilers need is just not feasible in a VM. You'll need a real machine for profiling, I'm afraid.
回答2:
This error:
/usr/local/bin/ophelp: cannot execute binary file
usually means that you are attempting to execute an x86_64
binary on a 32-bit kernel.
What do file usr/local/bin/ophelp
and uname -a
print?
回答3:
A couple of years ago I had some problem running oprofile inside vmware. I wrote my little experience on this post http://blogs.epfl.ch/category/3239
回答4:
You could try installing older versions like oprofile-0.9.7
extract it anywhere then follow steps:
install it by > 1 ./configure 2. make 3. make install
Then try using it it works fine you might want to turn on virtual CPU counters in VMWARE and disable nmi_watchdog registers in linux as they might be used by other profilers.
回答5:
use of HPC(hardware performance counters) requires hardware supprot, try to install cpuid in vbox, you will see
Architecture Performance Monitoring Features (0xa/ebx):
core cycle event not available = false
instruction retired event not available = false
reference cycles event not available = false
last-level cache ref event not available = false
last-level cache miss event not avail = false
branch inst retired event not available = false
branch mispred retired event not avail = false
Architecture Performance Monitoring Features (0xa/edx): number of fixed counters = 0x0 (0) bit width of fixed counters = 0x0 (0)
It seems that just Vmware and KVM can emulate PMU unit, and not the VBOX
来源:https://stackoverflow.com/questions/3675732/oprofile-on-linux-running-in-a-virtual-machine