運行perf stat ls
表明這一點:爲什麼perf stat顯示「stalled-cycles-backend」爲<不支持>?
Performance counter stats for 'ls':
1.388670 task-clock # 0.067 CPUs utilized
2 context-switches # 0.001 M/sec
0 cpu-migrations # 0.000 K/sec
266 page-faults # 0.192 M/sec
3515391 cycles # 2.531 GHz
2096636 stalled-cycles-frontend # 59.64% frontend cycles idle
<not supported> stalled-cycles-backend
2927468 instructions # 0.83 insns per cycle
# 0.72 stalled cycles per insn
615636 branches # 443.328 M/sec
22172 branch-misses # 3.60% of all branches
0.020657192 seconds time elapsed
爲什麼顯示爲「不支持」停頓週期,後臺?我需要什麼樣的CPU,硬件,內核或用戶空間軟件才能看到這個值?
目前在RHEL上使用Linux 3.12 for x86_64,在不同的Intel Core i5和i7系統(Ivy Bridge類型)上使用匹配的「perf」版本。它們都不支持停滯週期後端。
一些更多的信息:
$ perf list | grep stalled
stalled-cycles-frontend OR idle-cycles-frontend [Hardware event]
stalled-cycles-frontend OR cpu/stalled-cycles-frontend/ [Kernel PMU event]
$ ls /sys/devices/cpu/events/
branch-instructions bus-cycles cache-references instructions mem-stores
branch-misses cache-misses cpu-cycles mem-loads stalled-cycles-frontend
$ cat /sys/bus/event_source/devices/cpu/events/stalled-cycles-frontend
event=0x0e,umask=0x01,inv,cmask=0x01
編輯:只是使用Linux 3.2(32位)試過這種的AMD羿龍II X6 1045T CPU上的Ubuntu 12.04下 - 在這裏它顯示值都停滯-cycles-front和stalled-cycles-backend。
感謝extensicve答案!到目前爲止,我還沒有找到對應於stalled-cycles-frontend或stalled-cycles-backend的「原始」事件編號。對於前者,它應該是「-e r10e」,但這並不完全匹配;對於後者,它可能是'-e r1b1'根據http://stackoverflow.com/questions/22165299/;根據英特爾PDF,這將是UOPS_EXECUTED.THREAD - 不確定這是否合理? – oliver
似乎像英特爾在發佈新的微架構時保留了表19-1「架構性能事件」中的數字,但其他可能與實現有關?不知道。 – amdn
漂亮而雄辯的答案。試過'perf stat -e r412e -e cache-missses date',我得到了r412e和cache-missses的相同結果。但是當我對'perf stat -e r412e -e cache-missses real-slow-application'做同樣的處理時,我會在10秒內運行的應用程序中得到不同的結果。任何想法爲什麼? – insumity