CPUで利用可能なPMCイベントを調べる方法
1. perf list を使う
code:perf list
$ perf list | grep -i hardware
2. /sys/devices/cpu/events/ ディレクトリを見る
/sys/devices/cpu/events/ ディレクトリの中にあるファイルを見る
code:cat events
$ ls /sys/devices/cpu/events/ -1
branch-instructions
branch-misses
bus-cycles
cache-misses
cache-references
cpu-cycles
instructions
mem-loads
mem-stores
ref-cycles
topdown-fetch-bubbles
topdown-recovery-bubbles
topdown-recovery-bubbles.scale
topdown-slots-issued
topdown-slots-retired
topdown-total-slots
topdown-total-slots.scale
ファイルの中を見れば、カウンタのMSR設定値 (event=XX, umask=YY) を確認できる
code:msr
$ cat /sys/devices/cpu/events/cache-misses
event=0x2e,umask=0x41
3. /proc/cpuinfo でCPUのモデルを確認し、Intelの公式ドキュメントと照らし合わせる
cpuinfoをチェック
Intel SDM を見る
code:cpuinfo
$ cat /proc/cpuinfo | grep "model name"
model name : Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz
4. カーネルのソースコードを確認する
linux/arch/x86/events/ とかにある