2010-10-27 05:01:23     Problems using OProfile

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-10-27 05:01:23     Problems using OProfile

Robert Homann (GERMANY)

Message: 95318   

 

Hi!

 

I've tried using OProfile on Blackfin uClinux, but didn't get any useful results yet. The problem is with opreport printing some error for some reason. We are using the kernel from uclinux.org, trunk r9160, on a Blackfin 525. OProfile sources are as included in the uClinux distribution. All binaries are compiled as FDPIC.

 

OProfile support is compiled into the kernel and this line appears in the kernel log:

 

[    1.750000] oprofile: using timer interrupt.

 

I guess this is OK so far.

 

Here is the output of OProfile 0.9.1 after a fresh boot:

 

 

/ # /usr/bin/ophelp -v

/usr/bin/ophelp: oprofile 0.9.1 compiled on Oct 27 2010 09:27:57

/ # /usr/bin/bfin_opcontrol --init

/ # /usr/bin/bfin_opcontrol --start-daemon

/ # Using 2.6+ OProfile kernel interface.

Reading module info.

Using log file /var/lib/oprofile/oprofiled.log

 

/ # /usr/bin/bfin_opcontrol --start

/ # /var/prog

-712902714

/ # /usr/bin/bfin_opcontrol --dump

/ # /usr/bin/opreport -l

/usr/bin/opreport error: /var/lib/oprofile/samples/current/{root}/var/prog/{dep}/{root}/var/prog/TIMER.0.0.all.all.all: No such device

 

The /var/prog program is a simple test program that performs some random computations for about 10 seconds and prints the (meaningless) result.

 

After playing around with command line arguments I gave up and tried OProfile 0.9.4 instead. After deleting /var/lib/ the results look similar, but the error message thrown by opreport is a bit different:

 

/ # /usr/bin/ophelp -v

/usr/bin/ophelp: oprofile 0.9.4 compiled on Oct 27 2010 09:51:18

 

...

 

/# /usr/bin/opreport -l

/usr/bin/opreport error: Invalid sample file, bad magic number: /var/lib/oprofile/samples/current/{root}/var/prog/{dep}/{root}/var/prog/TIMER.0.0.all.all.all

 

Still no success.

 

Can someone give a hint what could be going wrong? Do I need to enable any specific kernel options (except for CONFIG_PROFILING and CONFIG_OPROFILE), or could OProfile support even be broken on Blackfin?

 

 

By the way, I have applied the following changes to get OProfile to work:

 

- In order to avoid a linking error (undefined reference to `_fork'), I had to disable opd_fork() with an "#ifndef __uClinux__". This applies to both, 0.9.1 and 0.9.4 The compiler was invoked with -O0, so this might be the reason.

 

- In user/oprofile/bfin_opcontrol I had to replace "#!/bin/sh" by "#!/bin/hush", because our /bin/sh is Sash.

 

- When using OProfile 0.9.4, oprofiled throws an assertion in op_config.c, line 40, so I had to patch bfin_opcontrol to get oprofiled started with --session-dir=/var/lib/oprofile. Most likely not the best fix, though.

 

Best regards,

Robert Homann

QuoteReplyEditDelete

 

 

2010-10-28 23:26:45     Re: Problems using OProfile

Aaron Wu (CHINA)

Message: 95375   

 

R9160 is pretty old, have you tried on the latest 2010R1 branch? meanwhile we will take a look at it on our side

QuoteReplyEditDelete

 

 

2010-10-29 08:23:32     Re: Problems using OProfile

Robert Homann (GERMANY)

Message: 95398   

 

No, I didn't try a more recent version yet. I thought the r9160 would be good enough, considering it's only a bit older than one month. But you are right, I should also try the latest version. This will have to wait until the week after the next, though.

 

I would be grateful if you could take a look and report if OProfile, and which version, is actually working on recent kernels.

QuoteReplyEditDelete

 

 

2010-11-18 05:42:56     Re: Problems using OProfile

Aaron Wu (CHINA)

Message: 95941   

 

What's your updated status for this issue? If with the newer version you still have problem may you try the default test as in our wiki.

 

I tried on my 2010R1 branch, r9828, the oprofile as documented in   docs.blackfin.uclinux.org/doku.php?id=linux-kernel:oprofile. I do get it working and get meaningful output.

QuoteReplyEditDelete

 

 

2010-11-19 03:16:11     Re: Problems using OProfile

Aaron Wu (CHINA)

Message: 95972   

 

Also please make sure the application binary under user/whetstone/whetstone is used for Oprofile instead the one under romfs

Attachments

    Outcomes