1

I am trying to profile my userspace program on aria10 fpga board (with 2 ARM Cortex A9 CPUs) which has PMU support. I am running windriver linux version 9.x. I built my kernel with almost all of the CONFIG_ options people suggested over the internet. Also, my pgm is compiled with –fno-omit-frame-pointer and –g options.

What I see is that ‘perf record’ doesn’t generate any samples at all. ‘perf stat true’ output looks to be valid though (not sure what to make out of it). Does anyone have suggestion/ideas why I am not seeing any sample being generated?

~: perf record --call-graph dwarf --  my_app

^C
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.003 MB perf.data ]

~: perf report -g graph --no-children
Error:
The perf.data file has no samples!
 To display the perf.data header info, please use --header/--header-only options.

~: perf stat true

 Performance counter stats for 'true':

      1.095300      task-clock (msec)         #    0.526 CPUs utilized          
             0      context-switches          #    0.000 K/sec                  
             0      cpu-migrations            #    0.000 K/sec                  
            22      page-faults               #    0.020 M/sec                  
       1088056      cycles                    #    0.993 GHz                    
        312708      instructions              #    0.29  insn per cycle         
         29159      branches                  #   26.622 M/sec                  
         16386      branch-misses             #   56.20% of all branches        

   0.002082030 seconds time elapsed

I don't use a VM in this setup. Arria10 is intel FPGA with 2 ARM CPUs that supports PMU.


Edit: 1. I realize now that ARM CPU has HW PMU support (opposite to what I mentioned earlier). Even with HW PMU support, I am not able to do 'perf record' successfully.

9
  • 1
    Have you tried perf record with other hardware/software events like cpu-cycles or cpu-instructions ? Apr 27, 2018 at 5:02
  • Try putting a repeat loop in your program to make it run longer. perf record does statistical sampling, so if a perf counter never overflows it won't get any samples. Apr 27, 2018 at 9:12
  • @ArnabjyotiKalita tried those events with perf record and it doesn't work. however 'perf stat' does give reasonable output.
    – badmad
    Apr 27, 2018 at 18:31
  • @PeterCordes I had tried what you said as well as waiting for a longer duration (my program takes around 10% of CPU). so there is reasonable amount of processing occurring within my application.
    – badmad
    Apr 27, 2018 at 18:34
  • 1
    Do you need to run perf as root, or set /proc/sys/kernel/perf_event_paranoid to 0, to profile kernel time? Or does it spend most of that 10% in user-space? (Your profile output doesn't say cycles:u for user-space-only, so you're probably ok). IDK, you didn't tag this with an architecture and I don't even know what Aria10 is. Apr 27, 2018 at 18:37

1 Answer 1

6

This is an old question, but for people who find this via search:

perf record -e cpu-clock <command>

works for me. The problem seems to be that th default event (cycles) is not available

1
  • Yes the perf stat output clearly includes a cycles event.
    – Jan Hudec
    Oct 20, 2021 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.