2010-09-09 117 views
0

我正在使用VirtualBox運行Linux Ubuntu 10.4 VM。我正在嘗試使用oprofile來分析虛擬機中的某個應用程序。我已經安裝了oprofile 0.9.6,但我無法讓它工作。當我嘗試啓動我得到以下錯誤:在虛擬機上運行的Linux上的oprofile

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 
[email protected]:/usr/local/bin# /sbin/modprobe oprofile timer=1 
[email protected]:/usr/local/bin# opcontrol --init 

但仍然無法正常工作,我得到同樣的錯誤。甚至有可能在VM中運行oprofile?

感謝

回答

0

我已經試過在過去類似的東西,只有在VMware Fusion和不同的探查,並且碰到了同樣的問題。似乎訪問性能寄存器和其他分析員需要的低級別內容在虛擬機中不可行。恐怕,您需要一臺真正的機器來進行分析。

+0

我期待不能訪問的性能計數器,但我汝ght至少定時器中斷應該可用於「虛擬化」系統。 – celavek 2010-09-09 11:12:56

0

此錯誤:

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

通常意味着你正試圖在32位內核執行x86_64二進制文件。

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

0

幾年前,我在vmware內部運行oprofile時遇到了一些問題。我寫這篇文章我的一點心得http://blogs.epfl.ch/category/3239

+0

那麼,在您的解決方案中,沒有任何硬件計數器可用於訪客系統?系統定時器用於定期生成採樣事件。 – osgx 2012-08-11 13:17:58

+0

正確,vm會過濾掉這些寄存器。我認爲這不是一件容易的事情(即複用這些寄存器)。 – Tralamazza 2012-10-09 17:14:16

0

你可以嘗試安裝舊版本一樣oprofile-0.9.7

提取它的任何地方,然後按照步驟:

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

然後嘗試使用它,它工作正常,你可能想打開VMWARE中的​​虛擬CPU計數器並禁用linux中的nmi_watchdog寄存器,因爲它們可能會被其他分析器使用。

0

使用HPC(硬件性能計數器)的需要硬件supprot,嘗試安裝在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