Perf
為什麼我在性能列表中找不到硬體記憶體事件?
我在新買的筆記型電腦上使用 linux perf 時遇到問題:我的 perf 列表中沒有可用的硬體記憶體效果!!!嗯,這真的是我想要採樣的所有重要資訊!這是我的性能列表:
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 ]
雖然這是我以前看到的性能列表:https ://perf.wiki.kernel.org/index.php/Tutorial#Events 。
我以前做的是:
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]
但這在我的新機器上不起作用。在這種情況下,我如何收集我想要的數據?
我正在使用帶有核心 <3.19.0-56> 的 Ubuntu 14.04。性能版本 <3.19.8-ckt15>。
更新
我安裝了
papi-tools
庫,並papi_native_avail
給了我Available 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
首先,檢查處理器是否有硬體計數器。英特爾 Haswell 架構停止在最近的處理器中提供硬體計數器(出於某種原因)。
其次,我會檢查您是否可以通過例如
papi
.papi_native_avail
如果 Ubuntu 提供了足夠新的數據庫,該命令應該列出您的本地事件。第三種可能性是事件在這裡,但舊的不支持
perf
。是的,Ubuntu 14.04 已經兩年了,核心/工具可能不完全支持目前的處理器。
另外值得注意的是,它
perf list
可以根據它是否以root
. (也許有一些配置設置root
不是決定因素;我不確定。)在我的 Linux Mint 18.1 機器上,執行 4.8.0-34-generic 核心:
$ 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]