Hi Maynad,
Thanks for your reply.

oprofile on the target is working after copying all binaries and libraries to the target(Arm-cortexA9).
I can run oprofile only in timer mode.
But if I run oprofile in using hardware performance counter its failing.

I am using the following commands to run oprofile in normal mode

# opcontrol -v
opcontrol: oprofile 0.9.7git compiled on Apr 29 2011 11:00:14

On the target always opcontrol --setup fails with below error,
I am manually creating the directory /dev/oprofile and mounting the oprofilefs

# opcontrol --no-vmlinux

When I set the events as below I am getting error

# opcontrol --event=CPU_CYCLES:64:0x00:1:1

/opt/oprofile/bin/opcontrol: line 2071: id: not found
sh: 0: unknown operand
/opt/oprofile/bin/opcontrol: line 2100: id: not found
sh: 0: unknown operand
/opt/oprofile/bin/opcontrol: line 1: seq: not found
/opt/oprofile/bin/opcontrol: line 1: seq: not found
/opt/oprofile/bin/opcontrol: line 2103: seq: not found

After that I treid to start oprofile .

# opcontrol --start
/opt/oprofile/bin/opcontrol: line 2071: id: not found
sh: 0: unknown operand
/opt/oprofile/bin/opcontrol: line 2100: id: not found
sh: 0: unknown operand
/opt/oprofile/bin/opcontrol: line 2102: seq: not found
/opt/oprofile/bin/opcontrol: line 2102: seq: not found
/opt/oprofile/bin/opcontrol: line 2103: seq: not found
/opt/oprofile/bin/opcontrol: line 2103: seq: not found
oprofiled: no events specified.
Usage: oprofiled [OPTION...]
      --session-dir=/var/lib/oprofile         place sample database in dir instead of default location
  -r, --kernel-range=start-end        Kernel VMA range
  -k, --vmlinux=file             vmlinux kernel image
      --no-vmlinux            vmlinux kernel image file not available
      --xen-range=start-end           Xen VMA range
      --xen-image=file           Xen image
      --image=profile these comma separated image               image name filter
      --separate-lib=[0|1]        separate library samples for each distinct application
      --separate-kernel=[0|1]     separate kernel samples for each distinct application
      --separate-thread=[0|1]     thread-profiling mode
      --separate-cpu=[0|1]        separate samples for each CPU
  -e, --events=[events]              events list
  -v, --version               show version
  -V, --verbose=all,sfile,arcs,samples,module,misc             be verbose in log file
  -x, --ext-feature=<extended-feature-name>:[args]         enable extended feature

Help options:
  -?, --help                  Show this help message
      --usage                 Display brief usage message
Couldn't start oprofiled.
Check the log file "/var/lib/oprofile/samples/oprofiled.log" and kernel syslog

The log file "/var/lib/oprofile/samples/oprofiled.log" is also not created.

I tried running daemon

#oprofiled --events=CPU_CYCLES:64:0x00:1:1 --no-vmlinux  --kernel-range 0xc002d000,0xc046f000 -V=all
oprofiled: malformed events passed on the command line

But ophelp is showing all the events.

So the daemon is also not starting and its failing to profiling in normal mode for Armv7-ca9

Another issue is:
I can able to the run the oprofile in the taget(Arm-cortexA9) in timer mode

As I am running the oprofile on the target,I don't have vmlinux binary on the target.It is flashed in the nand.In this case how can I specify the kernel to profile.

How can I profile the kernel object file(.ko files) using oprofile.In manual it just mentioned to use -p option.

It is not very much clear for profiling a single or multiple  ".ko" files.

Thanks in advance,
Durga Prasad

On Thu, Apr 28, 2011 at 11:42 PM, Maynard Johnson <maynardj@us.ibm.com> wrote:
On 04/27/2011 9:10 PM, durga prasad wrote:
Hi Maynard,

Thanks for your reply.

Actually I downloaded the oprofile from git repository only.The current version
I am running on my target is as below.

*# opcontrol -v
opcontrol: oprofile 0.9.7git compiled on Apr 25 2011 16:54:12*

Initially I  tried to run the oprofile 0.9.7 git in normal mode using hardware
counter .As it is not working in that mode I am running oprofile in timer mode.

When I run the oprofile in normal mode the oprofiled daemon is not starting and
it always gives error like unable to find the events and unitmask.

Also I am using opcontrol --reset every time before start of the opcntrol and
still I am getting the same error for opreport.

when I open the log file using the cat command
*# cat /var/lib/oprofile/samples/oprofiled.log*
*oprofiled: open of
ER.0.0.all.all.all failed: Invalid argument*

The total log is filled with the above error.

I copied the binaries to /usr/bin/ of the target.Do I need to copy any libraries
to the target.
That's definitely *not* sufficient.  I suggest you do a build on your host machine and configure with '--prefix=<my-oprof-install-dir>'.   After building, do a 'make install', then tar up the <my-oprof-install-dir> and move it over to your target.  You certainly had pieces missing that would have prevented you from using event-based profiling, so you shouldn't have to do timer-based profiling once it's set up right on the target.  As for all the errors in the log, that also may have something to do with missing stuff from the install -- although, I'm not sure.  So on your target, do:
 1. opcontrol --deinit
 2. opcontrol --reset
 3. delete oprofile binaries in /usr/bin
 4. delete the oprofiled log
 5. delete /root/.oprofile/daemonrc
 6. extract the tar file from your host containing <my-oprof-install-dir>
 7. start over again with opcontrol setup, start, etc.


Please let me any other information is required regarding this error.

Durga Prasad

On Thu, Apr 28, 2011 at 8:14 AM, Maynard Johnson <maynardj@us.ibm.com
<mailto:maynardj@us.ibm.com>> wrote:

   durga prasad wrote:
   >  Hi All ,
   >  I am trying to cross compile the oprofile 0.9.6 for ARMv7 for cortex A9 and
   >  it is success.
   >  I am facing issue while generating the report
   >  I am running the oprofile on the target on timer mode with the following
   >  command.
   >  *# insmod oprofile.ko timer=1*
   >  Insmod is success and it gives the following output
   >  *
   >  oprofile: using arm/armv7-ca9
   The message above implies that your kernel supports your processor.  As I've
   said before, if you upgrade your oprofile, you'll have full support for
   cortex A9 and won't have to use timer mode.

   >  oprofile: using timer interrupt.*
   >  I am running the following command in the target for the oprofile.
   >  *# opcontrol --start --no-vmlinux*
   >  /usr/bin/opcontrol: line 2071: id: not found
   So you installed oprofile in /usr on your target?  Not being embedded
   developer, I have to ask . . . is that typical?
   >  sh: 0: unknown operand
   >  /usr/bin/opcontrol: line 2100: id: not found
   >  sh: 0: unknown operand

   I've never seen/heard of this error before.  Pull the latest oprofile source
   and build/install it.  If you still get the error, then let us know.

   >  Using 2.6+ OProfile kernel interface.
   >  Using log file /var/lib/oprofile/samples/oprofiled.log
   >  Daemon started.
   >  Profiler running.
   >  ps commad will display the daemon.
   >  I ran my simple application and after that I dumped .
   >  *#opcontrol --dump
   >  #opcontrol --stop*
   >  After stoppping the profiler, I am generating the opreport with following
   >  command its failing.
   >  *# opreport -l*
   >  I am getting the following error.
   >  *
   >  opreport error: Invalid sample file, bad magic number:
   >  /var/lib/oprofile/samples/current/{kern}/no-v
   >  mlinux/{dep}/{kern}/no-vmlinux/TIMER.0.0.all.all.all*

   You probably have old sample data taken from an older, incompatible version
   of oprofile.  Be sure to use 'opcontrol --reset' at the beginning of your
   profile runs to clear out old profile data.

   >  when I used *oparchive* also I am getting the same error.
   >  *# oparchive -o /home/durga/
   >  oparchive error: Invalid sample file, bad magic number:
   >  /var/lib/oprofile/samples/current/{kern}/no-
   >  vmlinux/{dep}/{kern}/no-vmlinux/TIMER.0.0.all.all.all*
   >  Also I want to analyze the opreport on the host PC by transferring the files
   >  from the target to host. how can I do that?
   >  Is there any application to analyze the file generated by the oprofiler on
   >  the host PC ?

   There are sections in the user manual (see our website) on the topics of
   oparchive and opimport.  Also see the mailing list archives
   (http://marc.info/?l=oprofile-list) and look for the topic "Running oprofile
   on embedded systems" from June, 2008.


   >  It would be great if somebody suggests me the reason behind the above error.
   >  Thanks in Advance,
   >  Durga Prasad
   >  ------------------------------------------------------------------------------
   >  WhatsUp Gold - Download Free Network Management Software
   >  The most intuitive, comprehensive, and cost-effective network
   >  management toolset available today.  Delivers lowest initial
   >  acquisition cost and overall TCO of any competing solution.
   >  http://p.sf.net/sfu/whatsupgold-sd
   >  _______________________________________________
   >  oprofile-list mailing list
   >  oprofile-list@lists.sourceforge.net