>OProfile 0.9.8 can build on any 2.6 kernel.  Are you trying to build oprofile on your target or host?  What's the build error you're >getting?  You say above you do not have opannotate binary.  Are you referring to your target or host?  I think, usually, the oprofile >post-processing is all done on your host, so it's not surprising there would not be an opannotate on the target.  Have you looked at >http://developer.mips.com/tools/debuggers/oprofile/?  I don't know how up-to-date that site is, though.  Gergely (on cc) might be able >to help.

-Maynard

Hi again,
 
I am trying to build oprofile on my host through cross compiler. Its work for 0.9.4 version.  With 0.9.8 version I have this error :

op_perf_events_checker.c:24:
30: error: linux/perf_event.h: No such file or directory
op_perf_events_checker.c: In function 'main':
op_perf_events_checker.c:57: error: invalid application of 'sizeof' to incomplete type 'struct perf_event_attr'
op_perf_events_checker.c:58: error: invalid use of undefined type 'struct perf_event_attr'
op_perf_events_checker.c:58: error: invalid application of 'sizeof' to incomplete type 'struct perf_event_attr'
op_perf_events_checker.c:59: error: invalid use of undefined type 'struct perf_event_attr'
op_perf_events_checker.c:59: error: 'PERF_SAMPLE_IP' undeclared (first use in this function)
op_perf_events_checker.c:59: error: (Each undeclared identifier is reported only once
op_perf_events_checker.c:59: error: for each function it appears in.)
op_perf_events_checker.c:62: error: '__NR_perf_event_open' undeclared (first use in this function)
make[5]: *** [op_check_perfevents-op_perf_events_checker.o] Error 1

And its seem legit, if I check kernel source of 2.6.28.8, I have not in include directory a header file named perf_event.h.

If you check the code in op_perf_events_checker.c, you have some stuff like this :

#if HAVE_PERF_EVENTS
#include <linux/perf_event.h>
    struct perf_event_attr attr;
    pid_t pid ;
#endif

So ok my idea was to comment this kind of code even if I dont understand why the HAVE_PERF_EVENTS is define... If I try again to compile after this fix :

In file included from operf_counter.h:33,
                 from operf_utils.cpp:25:
operf_event.h:18:30: error: linux/perf_event.h: No such file or directory
In file included from operf_counter.h:33,
                 from operf_utils.cpp:25:
operf_event.h:28: error: field 'header' has incomplete type
operf_event.h:35: error: field 'header' has incomplete type
operf_event.h:44: error: field 'header' has incomplete type
operf_event.h:50: error: field 'header' has incomplete type
operf_event.h:57: error: field 'header' has incomplete type
operf_event.h:63: error: field 'header' has incomplete type
operf_event.h:72: error: field 'header' has incomplete type
operf_event.h:77: error: field 'header' has incomplete type
operf_event.h:144: error: field 'attr' has incomplete type
operf_event.h:149: error: field 'attr' has incomplete type

This header missing again... This time no #define, to way to comment this part of code which use this include.

Its not a problem due to my architecture but due to my kernel version, I cannot include a file which is not exist. I have check, this header seems to be in kernel linux since 2.6.32 only !

Meantime, I am trying to understand how oprofile work with the 0.9.4 version. I have set the vmlinux path to opcontrol. After profiling few minutes :

opcontrol --vmlinux=/root/vmlinux
opcontrol --start
...
opcontrol --stop

Next, I run this command to compute oprofile data :

opreport -p /lib/modules/2.6.28.8/ -l 2>/dev/null | grep "MODULE_NAME.ko"
923       0.0220  MODULE_NAME.ko            MODULE_NAME.ko             .text

I have no details about cpu usage by each function of my module. Just one line with the symbol .text. Do I have to link oprofile with compiled source (.o) of my kernel module to profile ?

Finally, I have already check this link : http://developer.mips.com/tools/debuggers/oprofile. Its on MIPS with Android kernel, the

Thanks for your time,
Arthur