2017-06-21 38 views
0

我目前正在學習使用perf。我爲硬件事件輸出,但不是用於cpu-cycles或cpu-clock等軟件事件。錯誤:perf.data文件沒有樣本

我調用PERF與verbose選項:

$ > perf record -v ./pi-serial-ps 
mmap size 528384B 
Reference Pi: 3.1415926536 
Simulated Pi: 3.1415209778 
[ perf record: Woken up 15 times to write data ] 
Looking at the vmlinux_path (7 entries long) 
Using /proc/kallsyms for symbols 
[ perf record: Captured and wrote 3.694 MB perf.data (96497 samples) ] 

調用PERF紀錄-e CPU時鐘提供同樣的輸出。 我看着真試樣尺寸:

$ > perf report -D -i perf.data | grep RECORD_SAMPLE | wc -l 
96497 

的PERF報告TUI提供了一個空表沒有錯誤。隨着詳細選項,它輸出:

$ > perf report -v perf.data 
build id event received for [kernel.kallsyms]: d9ffffc97cd9edb0ddd58462595dd69a8c8b694 
build id event received for /lib/modules 2.6.32-642.11.1.el6.Bull.106.x86_64/kernel/net/sunrpc/sunrpc.ko: 31402cf2d9ace7f86d54601334db6931390f8f6c 
build id event received for /home/h1/s7330426/_Exercises/X03/x03/pi-serial-ps: bd3a924ac41ff481a4bc5bf034853f03b76193f4 
build id event received for /lib64/ld-2.12.so: f3eebd18e66eb139ea4d76cdfa86d643abcf0070 
build id event received for /lib64/libc-2.12.so: 24d3ab3db0f38c7515feadf82191651da4117a18 

逆足註釋有此錯誤:

the perf.data file has no samples 

它無法正常輸出到控制檯,甚至不詳細選項。

我檢查這個問題 perf.data file has no samples 也是這個 http://www.spinics.net/lists/linux-perf-users/msg01437.html 這兩人都沒有解決我的問題。

我在沒有root權限的本地主機上使用Linux版本2.6.32-642.11.1.el6.Bull.106.x86_64。

任何幫助?

我發現了一個變通來衡量CPU的時鐘,但我不知道這是否是可靠的: perf: strange relation between software events

+0

PERF的版本2.6.32-642.13.1.el6.x86_64.debug 我還可以使用PERF 3.8.2版本,但是這將導致內存訪問錯誤。 –

+0

您是否嘗試從內核源代碼構建perf並使用它? –

+1

我正在安裝perf的羣集上工作,我沒有root權限 –

回答

0

開始perf stat獲得通用的原始性能計數器值:

perf stat ./pi-serial-ps 

如果某個事件event的原始計數超過了幾百或幾千,並且目標程序運行時間超過了幾毫秒,則可以使用perf record -e event(或perf record -e event:u不能剖析內核代碼)。通常將自動調諧採樣率記錄到幾kHz左右(例如,如果您的程序有1億個週期,則每100萬週期中可以選擇性能記錄作爲採樣生成器),而原始計數器值過低的事件可能不會生成任何採樣。您還可以爲每個樣本設置事件計數,其中-c選項爲perf記錄,在本示例中,我們詢問perf記錄以便在程序的用戶空間代碼中每10000次循環後生成樣本;零個樣本將用於它運行爲8469個循環的程序產生:

perf record -e cycles:u -c 10000 ./pi-serial-ps 
相關問題