簡體   English   中英

如何從性能統計信息輸出中解析指令數和經過時間

[英]How to parse number of instructions and elapsed time from output of perf stat

TL; DR

提供-x時,有什么方法可以使性能perf stat輸出時間過去?

背景

我執行了perf stat -e instructions:u make run ,並將輸出粘貼到下面。

 Performance counter stats for 'make run':

    53,781,961,288      instructions:u

       2.802749955 seconds time elapsed

      21.453244000 seconds user
       0.249223000 seconds sys

我想解析指令的數量和經過的時間,因此我添加了-x選項,以用逗號分隔輸出,並將相應的輸出粘貼在下面。

53781782267,,instructions:u,20694056846,100.00,,

我注意到沒有顯示所有時間測量值,因此我檢查了perf help stat的輸出。 CSV FORMAT部分中,我發現run time of counteroptional metric valueoptional unit of metric可能與我的需求有關,但是我無法弄清楚它的精確度。

如果(config->ru_display)為true, print_footer tools/perf/util/stat-display.c文件的 print_footer函數打印“經過的時間”。

print_footer沒有從所謂的perf_evlist__print_counters當出現“ -x , ”選項用於設置csv_output。

if (!interval && !config->csv_output)
    print_footer(config);

“用戶” /“ sys”時間在config->ru_data.ru_utimeru_data.ru_stime而“經過的秒數”是config->walltime_nsecs_stats

stat-display.c沒有其他代碼可以顯示ru_data.ru_utimeru_data.ru_stimewalltime_nsecs_stats ,因此在Linux內核版本4.20中,無法從CSV模式下的perf stat輸出時間。

您可以修補stat-display.c文件,你需要輸出任何東西和編譯perfcd tools/perf; make )。 其他內核版本的perf工具可與任何linux內核一起使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM