我有一台配备 Intel Core i7-4770 @ 3.4GHz CPU 的戴尔台式机。
在那里,我安装了 Ubuntu 服务器 15.04。之后我安装了 installlinux-tools-generic
和linux-tools-common
perf tools。但是,当我运行时,perf list
硬件部分不存在,甚至没有“不支持”。我之前做过的唯一一件事是安装 xen,Ubuntu 目前作为 Dom0 运行。我不确定这是否会对我的问题产生任何影响。
以下是我从命令中获得的信息perf list
:
ubuntuuser@ubuntu:~/work/linux$ perf list
List of pre-defined events (to be used in -e):
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]
power/energy-cores/ [Kernel PMU event]
power/energy-gpu/ [Kernel PMU event]
power/energy-pkg/ [Kernel PMU event]
power/energy-ram/ [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 ]
我想知道我的问题是什么?是 CPU 本身不支持硬件事件吗?还是来自存储库的内核没有启用硬件事件?如果只是内核,我想我只需要
答案1
在我使用一些硬件事件之前,我也没有列出任何硬件事件。现在,即使重新启动后,也会列出一些:
doug@s15:~$ perf list hw
List of pre-defined events (to be used in -e):
branch-instructions OR branches [Hardware event]
branch-misses [Hardware event]
bus-cycles [Hardware event]
cache-misses [Hardware event]
cache-references [Hardware event]
cpu-cycles OR cycles [Hardware event]
instructions [Hardware event]
ref-cycles [Hardware event]
stalled-cycles-backend OR idle-cycles-backend [Hardware event]
stalled-cycles-frontend OR idle-cycles-frontend [Hardware event]
doug@s15:~$ perf list pmu
List of pre-defined events (to be used in -e):
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]
mem-loads OR cpu/mem-loads/ [Kernel PMU event]
mem-stores OR cpu/mem-stores/ [Kernel PMU event]
power/energy-cores/ [Kernel PMU event]
power/energy-gpu/ [Kernel PMU event]
power/energy-pkg/ [Kernel PMU event]
ref-cycles OR cpu/ref-cycles/ [Kernel PMU event]
stalled-cycles-backend OR cpu/stalled-cycles-backend/ [Kernel PMU event]
stalled-cycles-frontend OR cpu/stalled-cycles-frontend/ [Kernel PMU event]
uncore_cbox_0/clockticks/ [Kernel PMU event]
uncore_cbox_1/clockticks/ [Kernel PMU event]
uncore_cbox_2/clockticks/ [Kernel PMU event]
uncore_cbox_3/clockticks/ [Kernel PMU event]
uncore_imc/data_reads/ [Kernel PMU event]
uncore_imc/data_writes/ [Kernel PMU event]
之前我做过这些:
doug@s15:~$ sudo ~/bin/perf stat -a sleep 5
Performance counter stats for 'system wide':
39997.230896 task-clock (msec) # 7.998 CPUs utilized (100.00%)
396 context-switches # 0.010 K/sec (100.00%)
8 cpu-migrations # 0.000 K/sec (100.00%)
82 page-faults # 0.002 K/sec
359,328,178 cycles # 0.009 GHz (83.29%)
827,261,275 stalled-cycles-frontend # 230.22% frontend cycles idle (83.33%)
797,161,705 stalled-cycles-backend # 221.85% backend cycles idle (66.74%)
49,220,050 instructions # 0.14 insns per cycle
# 16.81 stalled cycles per insn (83.37%)
10,011,396 branches # 0.250 M/sec (83.37%)
1,800,790 branch-misses # 17.99% of all branches (83.29%)
5.000925953 seconds time elapsed
doug@s15:~$ sudo ~/bin/perf stat -e cycles,instructions,cache-references,cache-misses,bus-cycles -a sleep 5
Performance counter stats for 'system wide':
24,268,338 cycles (100.00%)
8,505,561 instructions # 0.35 insns per cycle (100.00%)
657,099 cache-references (100.00%)
73,174 cache-misses # 11.136 % of all cache refs (100.00%)
1,507,017 bus-cycles
5.001004407 seconds time elapsed
doug@s15:~$ sudo ~/bin/perf stat -e L1-dcache-loads,L1-dcache-load-misses,L1-dcache-stores sleep 5
Performance counter stats for 'sleep 5':
170,208 L1-dcache-loads
14,139 L1-dcache-load-misses # 8.31% of all L1-dcache hits
<not counted> L1-dcache-stores (0.00%)
5.000957676 seconds time elapsed
我不知道如何知道我的列表现在是否完整,如果不完整,也不知道如何获取完整列表。