Bug 582570

Summary: Cannot run oprofile inside DOMU
Product: Red Hat Enterprise Linux 5 Reporter: Kirby Zhou <kirbyzhou>
Component: oprofileAssignee: William Cohen <wcohen>
Status: CLOSED CANTFIX QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: low    
Version: 5.4CC: alanm, fche, sgehwolf
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-11 17:45:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kirby Zhou 2010-04-15 10:47:23 UTC
Description of problem:

Cannot run oprofile inside DOMU

Version-Release number of selected component (if applicable):

oprofile-0.9.4-15.el5

How reproducible:

100%

Steps to Reproduce:

opcontrol --init
opcontrol --start
opcontrol --dump
  
Actual results:

]# opcontrol --init

[root@xen-727057^10.227 oprofile]# opcontrol --start
/usr/bin/opcontrol: line 1160: echo: write error: Invalid argument
Using default event: CPU_CLK_UNHALTED:100000:0:1:1
Using 2.6+ OProfile kernel interface.
Failed to open profile device: Operation not permitted
Couldn't start oprofiled.
Check the log file "/var/lib/oprofile/samples/oprofiled.log" and kernel syslog

[root@xen-727057^10.227 oprofile]# opcontrol --dump
Unable to complete dump of oprofile data: is the oprofile daemon running?

Expected results:


Additional info:

I just want use the basic function of oprofile to profiling my program inside a DomU box.

Comment 1 William Cohen 2010-11-05 15:13:21 UTC
The performance counters are not available to profile in virtualized environments such as xen. You might be able to use the timer mode within the DomU.

If just measuring things within a domU, as root you could do the following to use the timer mode:

opcontrol --deinit 
rm -f /root/.oprofile/daemonrc
modprobe oprofile timer=1
opcontrol --reset
opcontrol --vmlinux=/usr/lib/debug/lib/modules/`uname -r`/vmlinux \
  --separate=library
opcontrol --start

This has been verified to work with oprofile-0.9.4-15.el5.

Comment 2 Frank Ch. Eigler 2013-03-11 17:45:28 UTC
Since xen did not virtualize perf counters sufficiently, the approximation in comment #1 is probably the best oprofile can do.