Re: oprofile: enabling cpu events

From: Baruch Even
Date: Sat May 07 2005 - 10:10:01 EST


li nux wrote:
I want to profile cpu events using oprofile, when i
issue following command, it gives me an error saying
that oprofile is in timer mode.
What does it mean ?
the link
http://oprofile.sourceforge.net/docs/intel-piii-events.php3
says event=CPU_CLK_UNHALTED is suppported for Pentium
II processor.

Is there any way i can enable cpu events ?

# opcontrol --setup --event=CPU_CLK_UNHALTED
You cannot specify any performance counter events
because OProfile is in timer mode.

The code has some "protection" against too new processors, the kernel folks prefer that you use older CPUs, or use newer kernels.

The patch that worked for me against 2.6.6 is attached.

Baruch arch/i386/oprofile/nmi_int.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

Index: 2.6.6/arch/i386/oprofile/nmi_int.c
===================================================================
--- 2.6.6.orig/arch/i386/oprofile/nmi_int.c
+++ 2.6.6/arch/i386/oprofile/nmi_int.c
@@ -313,7 +313,7 @@ static int __init p4_init(void)
{
__u8 cpu_model = current_cpu_data.x86_model;

- if (cpu_model > 3)
+ if (cpu_model > 100)
return 0;

#ifndef CONFIG_SMP