I am using 'perf record' command to sample hardware counters at 1 ms. It provides me a 'perf.data' as the output file but I am not aware of any tool/command that will help me to read the counter data from the 'perf.data' binary file into a text or CSV file. Or simply put, I need to read the hardware counter event data at every 1ms from the 'perf.data' file.
Some more Details:
I have used 'perf stat' command to get hardware counter event data at 10ms but it doesn't allow sampling at sampling interval less than 10ms. So, I am using 'perf record' instead of perf stat to sample at 1ms. Some useful links which convinced me to use perf record: Perf Stat vs Perf Record and Collecting the data for a partiulcar process from PMU for every 1 milli second
I have also tried 'perf script' but it only provides support some hardware events. For example: cache events are not supported by perf script. link: Can't sample hardware cache events with linux perf
Can anyone help me with this, please? Please assume that I know how to use perf record command and already have the perf.data file(generated from perf record)
Edited: Following are the commands and their output message on the terminal using the feedback from the answers:
1) perf record -e LLC-stores,LLC-loads,cache-misses -F 999 -R -T ls>ls.txt
output:
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.017 MB perf.data (28 samples) ]
2) perf report -F sample,period --stdio
output:
Total Lost Samples: 0
Samples: 9 of event 'LLC-stores'
Event count (approx.): 7440
Samples Period
............ ............
9 7440
Samples: 9 of event 'LLC-loads'
Event count (approx.): 50008
Samples Period
............ ............
9 50008
Samples: 10 of event 'cache-misses'
Event count (approx.): 351826
Samples Period
............ ............
10 351826
3) perf script -F period,event
output:
1 LLC-stores:
1 LLC-loads:
1 cache-misses:
1 LLC-loads:
1 cache-misses:
61 LLC-loads:
58 cache-misses:
3097 cache-misses:
1 LLC-stores:
13 LLC-stores:
4748 LLC-loads:
1390 LLC-stores:
190186 cache-misses:
1 LLC-stores:
1 LLC-loads:
1 cache-misses:
1 LLC-loads:
1 cache-misses:
1 LLC-stores:
52 cache-misses:
50 LLC-loads:
20 LLC-stores:
4110 cache-misses:
2002 LLC-loads:
748 LLC-stores:
154319 cache-misses:
43143 LLC-loads:
5265 LLC-stores:
4) perf stat -I 1 -e LLC-stores,LLC-loads,cache-misses ls>ls.txt
output:
time counts unit events
0.006476856 1,115 LLC-stores
0.006476856 13,121 LLC-loads
0.006476856 9,371 cache-misses
Both perf report and perf script provide number of samples,period and event name but not the event count for each sample. It would be really helpful if you could tell me how to get the event count for the each 28 samples that we get from perf record.