在虚拟机中运行的 Linux 上的 oprofile
我正在使用 VirtualBox 运行 Linux Ubuntu 10.4 VM。我正在尝试使用 oprofile 来分析虚拟机中的某些应用程序。我已经安装了 oprofile 0.9.6 但我无法让它工作。当我尝试启动时,出现以下错误:
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
由于我不确定 VirtualBox 是否可以提供对性能计数器的访问(我在这里有疑问,所以如果您有任何指针,那就太好了)我将 oprofile 默认为计时器像这样中断:
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
但仍然无法正常工作,我遇到了同样的错误。是否可以在虚拟机中运行 oprofile?
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我过去尝试过类似的方法,只是使用 VMware Fusion 和不同的分析器,但遇到了同样的问题。似乎在虚拟机中访问性能寄存器和分析器所需的其他低级内容是不可行的。恐怕您需要一台真正的机器来进行分析。
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.
此错误:
通常意味着您正在尝试在 32 位内核上执行
x86_64
二进制文件。file usr/local/bin/ophelp
和uname -a
打印什么?This error:
usually means that you are attempting to execute an
x86_64
binary on a 32-bit kernel.What do
file usr/local/bin/ophelp
anduname -a
print?几年前,我在 vmware 中运行 oprofile 时遇到了一些问题。我在这篇文章中写下了我的一点经验 http://blogs.epfl.ch/category/3239
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
您可以尝试安装旧版本,例如 oprofile-0.9.7
将其解压到任意位置,然后按照步骤操作:
然后尝试使用它,它工作正常,您可能需要在 VMWARE 中打开虚拟 CPU 计数器,并在 linux 中禁用 nmi_watchdog 寄存器,因为它们可能是这样的被其他分析器使用。
You could try installing older versions like oprofile-0.9.7
extract it anywhere then follow steps:
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.
使用HPC(硬件性能计数器)需要硬件支持,尝试在vbox中安装cpuid,您将看到
架构性能监控功能(0xa/edx):
固定计数器的数量 = 0x0 (0)
固定计数器的位宽= 0x0 (0)
似乎只有Vmware和KVM可以模拟PMU单元,而不能模拟VBOX
use of HPC(hardware performance counters) requires hardware supprot, try to install cpuid in vbox, you will see
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