From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.10) Gecko/20071213 Fedora/2.0.0.10-3.fc8 Firefox/2.0.0.10 Description of problem: oprofile can't sample multiple events, due to what seems to be a missing kernel patch (commit 6b77df08a36d989f7dd00ccb6a026a0e96170d16). opcontrol understand multiple events, but on el5, only one event is actually caught. The problem has been found by others, using oprofile 0.9.3 on a 2.6.18-8.1.15-kernel (http://www.nabble.com/I-can-not-sample-multiple-events-with-0.9.3-on-X86_64!!-td13579481.html). Although I have not yet explicitly verified the patch in question on the 2.6.18-53.1.6-kernel, to me, it seems plausible that it would fix the problem. Version-Release number of selected component (if applicable): kernel-2.6.18-53.1.6.el5 How reproducible: Always Steps to Reproduce: 1. # opcontrol --no-vmlinux --event FLOPS:10000 --event CPU_CLK_UNHALTED 2. # opcontrol --status Daemon not running Event 0: FLOPS:10000:0:1:1 Event 1: CPU_CLK_UNHALTED:100000:0:1:1 Separate options: library vmlinux file: none Image filter: none Call-graph depth: 0 3. # opcontrol --start ; sleep 10 ; opcontrol --stop Using 2.6+ OProfile kernel interface. Using log file /var/lib/oprofile/oprofiled.log Daemon started. Profiler running. Stopping profiling. 4. # opreport -t 1 Actual Results: CPU: Core 2, speed 2333.42 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000 CPU_CLK_UNHALT...| samples| %| ------------------ 27064 35.6129 no-vmlinux 24430 32.1469 umath.so ... Expected Results: # opreport -t 1 CPU: Core 2, speed 1000 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000 Counted FLOPS events (number of FP computational micro-ops executed) with a unit mask of 0x00 (No unit mask) count 10000 CPU_CLK_UNHALT...| FLOPS:10000| samples| %| samples| %| ------------------------------------ 10292 65.4291 125 46.4684 no-vmlinux 2432 15.4609 23 8.5502 firefox-bin ... Additional info: commit 6b77df08a36d989f7dd00ccb6a026a0e96170d16 Author: Arun Sharma <arun.sharma> Date: Fri Sep 29 02:00:01 2006 -0700 [PATCH] oprofile: ppro: need to enable/disable all the counters Need to enable/disable all the counters instead of just counter 0. This affects all cpus with family=6, including i386/core. Usual symptom: only counter 0 provides samples. Other counters don't produce samples. Signed-off-by: Arun Sharma <arun.sharma> Cc: Philippe Elie <phil.el> Cc: John Levon <levon> Signed-off-by: Andrew Morton <akpm> Signed-off-by: Linus Torvalds <torvalds> diff --git a/arch/i386/oprofile/op_model_ppro.c b/arch/i386/oprofile/op_model_ppro.c index f88e05b..ca2447e 100644 --- a/arch/i386/oprofile/op_model_ppro.c +++ b/arch/i386/oprofile/op_model_ppro.c @@ -138,11 +138,14 @@ static int ppro_check_ctrs(struct pt_regs * const regs, static void ppro_start(struct op_msrs const * const msrs) { unsigned int low,high; + int i; - if (reset_value[0]) { - CTRL_READ(low, high, msrs, 0); - CTRL_SET_ACTIVE(low); - CTRL_WRITE(low, high, msrs, 0); + for (i = 0; i < NUM_COUNTERS; ++i) { + if (reset_value[i]) { + CTRL_READ(low, high, msrs, i); + CTRL_SET_ACTIVE(low); + CTRL_WRITE(low, high, msrs, i); + } } } @@ -150,11 +153,14 @@ static void ppro_start(struct op_msrs const * const msrs) static void ppro_stop(struct op_msrs const * const msrs) { unsigned int low,high; + int i; - if (reset_value[0]) { - CTRL_READ(low, high, msrs, 0); + for (i = 0; i < NUM_COUNTERS; ++i) { + if (!reset_value[i]) + continue; + CTRL_READ(low, high, msrs, i); CTRL_SET_INACTIVE(low); - CTRL_WRITE(low, high, msrs, 0); + CTRL_WRITE(low, high, msrs, i); } }
This was solved in BZ426096. *** This bug has been marked as a duplicate of bug 426096 ***