首页 > 解决方案 > Bash 脚本 Perf Stat 到 CSV

问题描述

我正在尝试将 PERF 结果保存在 CSV 文件中。我需要这些具有不同线程数的数据:

   345,622,750      cache-misses                                                
    22,368,050      tx-start                                                    
    22,362,278      tx-commit                                                   
         5,772      tx-abort                                                    
            94      tx-conflict                                                 
            59      tx-capacity                                                 

  16.641667950 seconds time elapsed

在这样的表中:

缓存未命中 | 交易开始 | tx 提交 | 发送中止 | 交易冲突 | tx 容量 | 运行

(结果线程=1)

(结果线程=2)

(结果线程=4)

(结果线程=8)

……

Code:
file=/dir/out.csv
i=0
threads=1

while [ $i -le 7 ]; do
perf stat -e cache-misses,tx-start,tx-commit,tx-abort,tx-conflict,tx-capacity ./${benchmark}.rtm -v32-r4096 -n10 -p40 -i2 -e8 -s1 -t$threads &>> ${file}
let threads=threads*2
let i=i+1

done

我得到了我的基准和性能的混合输出,我只需要 csv 文件的性能数据(统计数据和运行时)。

Scalable Data Generator - genScalData() beginning execution...
Finished generating edges
No. of intra-clique edges - 22043427
No. of inter-clique edges - 890631
Total no. of edges        - 22934058

Time taken for Scalable Data Generation is  6.383911 sec.


    genScalData() completed execution.

Kernel 1 - computeGraph() beginning execution...

    computeGraph() completed execution.

Time taken for kernel 1 is 10.230289 sec.

Time taken for all is 16.614200 sec.


 Performance counter stats for './ssca2.rtm -s20 -i1.0 -u1.0 -l3 -p3 -t1':

       345,622,750      cache-misses           //ONLY THIS                                     
        22,368,050      tx-start               //ONLY THIS                                    
        22,362,278      tx-commit              //ONLY THIS                                     
             5,772      tx-abort               //ONLY THIS                                      
                94      tx-conflict            //ONLY THIS                                       
                59      tx-capacity            //ONLY THIS                                     

      16.641667950 seconds time elapsed        //ONLY THIS 

标签: bashcsvpipeperf

解决方案


推荐阅读