4
votes

I recently installed Perf tool On my platform and wanted to use it for profiling my platform. I started profiling a standalone application.Below command I used

perf start ./helloworld

Performance counter stats for './helloworld':

  4.555957 task-clock                #    0.000 CPUs utilized
         1 context-switches          #    0.219 K/sec
         0 cpu-migrations            #    0.000 K/sec
       124 page-faults               #    0.027 M/sec
       <not supported> cycles
       <not supported> stalled-cycles-frontend
       <not supported> stalled-cycles-backend
       <not supported> instructions
       <not supported> branches
       <not supported> branch-misses

       60.005519331 seconds time elapsed

Now I am not sure how should I interpretate this output.is it expected output?

Also,what should I make of < not supported > filed here,Is there anything I need to enable to support this filed before run the command?

4

4 Answers

3
votes

Search for "Performance Events" in dmesg output. It might be disabled.

For instance, on my machine, I have this>>

Performance Events: SandyBridge events, Intel PMU driver.
PEBS disabled due to CPU errata.
CPUID marked event: 'cpu cycles' unavailable
CPUID marked event: 'instructions' unavailable
CPUID marked event: 'bus cycles' unavailable
CPUID marked event: 'cache references' unavailable
CPUID marked event: 'cache misses' unavailable
CPUID marked event: 'branch instructions' unavailable
CPUID marked event: 'branch misses' unavailable
2
votes

The lines indicate that your running kernel is missing support for the particular functionality perf needs to profile those aspects of your program. Since most of perf is in kernelspace, you need to ensure your kernel supports the features you need.

EDIT:

When it comes to enabling those features in your kernel, it depends. Unless those components have been compiled as kernel modules, you need to compile them yourself. If they are compiled as modules, you can just modprobe them. Try:

find /lib/modules/`uname -r` -regex .*perf.*

If a list appears, try modprobeing each of the module names. Otherwise, you need to compile the modules yourself or the entire kernel yourself.

0
votes

"not supported" is usually when kernel does not support perf even if the kernel has perf modules enabled. Or the hardware has not performance counters like some virtualized hardware may be? If there is no kernel support for perf, you will probably see "not counted"

-1
votes

It depends what you want to profile. Perf doesn't provide an ultimate answer telling you how fast your program is. If you want to measure performance you have to know where to look. For those lines saying , try giving them manually by -e flag. like perf stat -e cycles ./helloworld