Why Does Perf Stat Show "Stalled-Cycles-Backend" as <Not Supported>

Why does perf show that sleep takes all cores?

According to man page of perf stat subocmmand, you have -a option to profile full system:
http://man7.org/linux/man-pages/man1/perf-stat.1.html

   -a, --all-cpus
system-wide collection from all CPUs (default if no target is
specified)

In this "system-wide" mode perf stat (and perf record too) will count events on (or profile for record) all CPUs in the system. When used without additional argument of command, perf will run until interrupted by Ctrl-C. With argument of command, perf will count/profile until the command works. Typical usage is

perf stat -a sleep 10      # Profile counting every CPU for 10 seconds
perf record -a sleep 10 # Profile with cycles every CPU for 10 seconds to perf.data

For getting stats of single command use single process profiling (without -a option)

perf stat python3 test.py

For profiling (perf record) you may run without -a option; or you may use -a and later do some manual filtering in perf report, focusing only on the pids/tids/dsos of your application (This can be very useful if command to profile uses some interprocess requests to other daemons to do lot of CPU work).

--per-core, -A, -C <cpulist>, --per-socket options are only for system-wide -a mode. Try --per-thread with -p pid attach to process option.

what's the meaning of cycles annotation in perf stat

This is a thing I hate very much on perf, that the documentation and manual pages are outdated and searching for meaning of some values is pretty complicated. I did search for them once so I add my findings:

what's the meaning of 1.478 GHz

To my knowledge, the value after # is recalculation of the native counter value (the value in the first column) to the user-readable form. This value should roughly correspond to clock speed of your processor:

grep MHz /proc/cpuinfo

should give similar value. It is printed from tools/perf/util/stat-shadow.c.

and [46.17%] in cycles's annotation?

This value should correspond the the portion of time, the hardware counter was active. Perf allows to start more hardware counters and multiplex them in runtime, which makes it easier for programmer.

I didn't found the actual place in the code, but it is described in one recently proposed patch as (part of csv format):

+   - percentage of measurement time the counter was running

perf stat returning not supported for all events on ARCH Linux ARM

The solution I found was to downgrade from perf 4.5-2 to perf 4.3-1.

cd /var/cache/pacman/pkg/
sudo pacman -U perf-4.3-1-armv7h.pkg.tar.xz

Running perf stat ls now returns the counters I expect.



Related Topics



Leave a reply



Submit