Why can't I find hardware cache event in my perf list?
Solution 1
First of all, check if the processor has even the hardware counters. Intel Haswell architecture stopped to provide hardware counters in recent processors (for some reason).
Second of all, I would check if you can see hardware event through, for example papi
. The command papi_native_avail
should list you native events, if Ubuntu provides recent enough databases.
The third possibility is that the events are here, but not supported by the old perf
. Yes, Ubuntu 14.04 is two years old and the kernel/tools might not support current processors fully.
Solution 2
Also worth noting is that perf list
can give you different output depending on whether or not it's running as root
. (Perhaps there's some configuration setting that makes root
not be the deciding factor; I'm not sure.)
On my Linux Mint 18.1 box, running a 4.8.0-34-generic kernel:
$ perf list cache
List of pre-defined events (to be used in -e):
$ sudo perf list cache
List of pre-defined events (to be used in -e):
L1-dcache-load-misses [Hardware cache event]
L1-dcache-loads [Hardware cache event]
L1-dcache-stores [Hardware cache event]
L1-icache-load-misses [Hardware cache event]
LLC-load-misses [Hardware cache event]
LLC-loads [Hardware cache event]
LLC-store-misses [Hardware cache event]
LLC-stores [Hardware cache event]
branch-load-misses [Hardware cache event]
branch-loads [Hardware cache event]
dTLB-load-misses [Hardware cache event]
dTLB-loads [Hardware cache event]
dTLB-store-misses [Hardware cache event]
dTLB-stores [Hardware cache event]
iTLB-load-misses [Hardware cache event]
iTLB-loads [Hardware cache event]
node-load-misses [Hardware cache event]
node-loads [Hardware cache event]
node-store-misses [Hardware cache event]
node-stores [Hardware cache event]
Related videos on Youtube
Zheyuan Li
Updated on September 18, 2022Comments
-
Zheyuan Li over 1 year
I have a problem in using linux perf on a newly bought laptop: there is no available hardware cache effect in my perf list!!! Well, this is really all important information that I wish to sample!! Here is my perf list:
List of pre-defined events (to be used in -e): cpu-cycles OR cycles [Hardware event] instructions [Hardware event] cache-references [Hardware event] cache-misses [Hardware event] branch-instructions OR branches [Hardware event] branch-misses [Hardware event] bus-cycles [Hardware event] ref-cycles [Hardware event] cpu-clock [Software event] task-clock [Software event] page-faults OR faults [Software event] context-switches OR cs [Software event] cpu-migrations OR migrations [Software event] minor-faults [Software event] major-faults [Software event] alignment-faults [Software event] emulation-faults [Software event] dummy [Software event] branch-instructions OR cpu/branch-instructions/ [Kernel PMU event] branch-misses OR cpu/branch-misses/ [Kernel PMU event] bus-cycles OR cpu/bus-cycles/ [Kernel PMU event] cache-misses OR cpu/cache-misses/ [Kernel PMU event] cache-references OR cpu/cache-references/ [Kernel PMU event] cpu-cycles OR cpu/cpu-cycles/ [Kernel PMU event] instructions OR cpu/instructions/ [Kernel PMU event] power/energy-cores/ [Kernel PMU event] power/energy-gpu/ [Kernel PMU event] power/energy-pkg/ [Kernel PMU event] power/energy-ram/ [Kernel PMU event] ref-cycles OR cpu/ref-cycles/ [Kernel PMU event] rNNN [Raw hardware event descriptor] cpu/t1=v1[,t2=v2,t3 ...]/modifier [Raw hardware event descriptor] (see 'man perf-list' on how to encode it) mem:<addr>[:access] [Hardware breakpoint] [ Tracepoints not available: Permission denied ]
while this is the perf list I used to see: https://perf.wiki.kernel.org/index.php/Tutorial#Events.
What I used to do is:
sudo perf stat -e L1-dcache-loads,L1-dcache-load-misses,LLC-loads,LLC-load-misses -a --append -o perf.txt [some command to run a file]
but this does not work on my new machine. How can I collect data I want in this case?
I am using Ubuntu 14.04, with kernel <3.19.0-56>. Perf version <3.19.8-ckt15>.
update
I installed the
papi-tools
library, andpapi_native_avail
gives meAvailable native events and hardware information. PAPI Version : 5.3.0.0 Vendor string and code : GenuineIntel (1) Model string and code : Intel(R) Core(TM) M-5Y71 CPU @ 1.20GHz (61) CPU Revision : 4.000000 CPUID Info : Family: 6 Model: 61 Stepping: 4 CPU Max Megahertz : 2900 CPU Min Megahertz : 500 Hdw Threads per core : 1 Cores per Socket : 2 Sockets : 2 NUMA Nodes : 1 CPUs per Node : 4 Total CPUs : 4 Running in a VM : no Number Hardware Counters : 0 Max Multiplex Counters : 64
-
Zheyuan Li about 8 yearsThank you. Please see my update. I have put on the output of
papi_native_avail
. I see that the number of hardware counters is 0. -
Zheyuan Li about 8 yearsAre the first point and the second the same thing?
-
Zheyuan Li about 8 yearsWell, if Intel stops providing hardware event counter.... Ah, let me make a guess. Does intel want people to use his own tool:
Intel PCM
orIntel VTune
instead? -
Jakuje about 8 yearsBasically yes. But it is the easiest way to "verify" the first point :) I tried to search for some data-sheet, but I have no success on their pages. I don't know about
Intel PCM
norIntel VTune
, but if there are no hardware counters, there is no way to get any information about performance. -
Zheyuan Li about 8 yearsWell, that is really bad news... in the future there is no way to get cache statistics...
-
AdamKalisz almost 5 yearsKind of stupid distinction to give a different list with sudo and without but ok, helped me anyway :-)