在虚拟机中运行的 Linux 上的 oprofile

发布于 2024-09-18 00:14:13 字数 880 浏览 6 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

謸气贵蔟 2024-09-25 00:14:13

我过去尝试过类似的方法,只是使用 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.

圈圈圆圆圈圈 2024-09-25 00:14:13

此错误:

/usr/local/bin/ophelp: cannot execute binary file

通常意味着您正在尝试在 32 位内核上执行 x86_64 二进制文件。

file usr/local/bin/ophelpuname -a 打印什么?

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?

请止步禁区 2024-09-25 00:14:13

几年前,我在 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

朱染 2024-09-25 00:14:13

您可以尝试安装旧版本,例如 oprofile-0.9.7

将其解压到任意位置,然后按照步骤操作:

install it by >  1 ./configure 2. make 3. make install

然后尝试使用它,它工作正常,您可能需要在 VMWARE 中打开虚拟 CPU 计数器,并在 linux 中禁用 nmi_watchdog 寄存器,因为它们可能是这样的被其他分析器使用。

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.

撩动你心 2024-09-25 00:14:13

使用HPC(硬件性能计数器)需要硬件支持,尝试在vbox中安装cpuid,您将看到

 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

架构性能监控功能(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/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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文