I am trying to use perf
on my device with an AMD cpu, but I can't really find any information about how to get, let's say, cache-misses
from AMD. I read that you need to write -e rNNN
, where NNN
is a hex-code of event, but I didn't manage to find any table or something to look at those codes. Could you help me with this, because it seems that there is no information in the internet at all! Actually, in the manual for perf
there are some links, but they are not valid :(
AMD perf events
2.9k views Asked by Baz Pasha At
1
Check
perf list
output, in modern Linux kernel versions it may report some architecture-specific hardware events. Some generic hardware events may be always reported byperf list
(especially with older kernels), but not all of them are mapped to some real hardware event. Thecache-misses
andcycles
are such generic perf hw events, not always mapped (mapping is in perf source code around http://elixir.free-electrons.com/linux/latest/source/arch/x86/events/amd/core.c for amd - withcache-misses
mapped to[PERF_COUNT_HW_CACHE_MISSES] = 0x077e,
).Also try different events from perf list with
perf stat -e event1,cycles,instructions,cpu-clock
where event1 is the event you want to check and there are some working events.To encode raw events it can be easier to use processor docs, perf sources (for exact hex encoding) and some external tools. For Intel there is
ocperf.py
from http://github.com/andikleen/pmu-tools site; and there is generic raw generator in perfmon2/libpfm4, described at http://www.bnikolic.co.uk/blog/hpc-prof-events.html "How to monitor the full range of CPU performance events" by Bojan Nikolic withshowevtinfo
util (it is also recommended way of getting rXXXX codes for perf in FAQ: http://web.eece.maine.edu/~vweaver/projects/perf_events/faq.html#q2e Q2e. How do I determine the proper "raw" event value):