首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Linux计数指令、周期、Cache在很长一段时间里错过了更轻量级的

Linux计数指令、周期、Cache在很长一段时间里错过了更轻量级的
EN

Stack Overflow用户
提问于 2016-01-24 21:52:24
回答 1查看 1.3K关注 0票数 0

为了我的研究,我想介绍一些在不同限制下的程序。我使用perf工具来测量一些计数器。这种分析将持续很长一段时间(几个小时),perf工具会生成我不需要的太多数据。例如:

代码语言:javascript
复制
$ perf record -e cycles,instructions,cache-misses,cpu-clock,context-switches,cpu-migrations ./stress-ng --cpu 4 --cpu-ops 10000
stress-ng: info:  [6642] defaulting to a 86400 second run per stressor
stress-ng: info:  [6642] dispatching hogs: 4 cpu
stress-ng: info:  [6642] successful run completed in 15.57s
[ perf record: Woken up 117 times to write data ]
[ perf record: Captured and wrote 29.971 MB perf.data (~1309444 samples) ]

它相当于1.92 MBs每秒。在24小时内,将达到165 GBs。当我使用perf报告工具时,我看到它也保留了我不需要的函数调用。如何使perf记录工作更加轻量级,并且只记录我需要的数据?随着时间的推移,我只需要对以下数据进行分析,就可以看到随着对系统所做的一些更改,它们是如何变化的。考虑到它记录了大量的数据,我将在24台核心机器上使用它,这使得数据非常大。到目前为止,最好的选择是定期记录并分析perf.data以获得我想要的整数并删除它,但是我认为应该有一个更好的选择,因为我可能会错过该窗口中的一些分析数据。

代码语言:javascript
复制
 Performance counter stats for './stress-ng --cpu 4 --cpu-ops 10000':

   128.290.294.651      cycles                   
   201.217.788.817      instructions              #    1,57  insns per cycle        
         3.048.096      cache-misses                                                
      40340,258757      cpu-clock (msec)                                            
               123      context-switches                                            
                25      cpu-migrations                                              

      10,205760993 seconds time elapsed     
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-24 23:48:56

简单的perf stat输出对您有好处吗?例如

代码语言:javascript
复制
$ perf stat -e cycles,instructions,cache-misses,cpu-clock,context-switches,cpu-migrations date 
Sun Jan 24 18:46:10 EST 2016

 Performance counter stats for 'date':

         1,269,265      cycles                   
           660,875      instructions              #    0.52  insns per cycle        
             2,265      cache-misses                                                
          0.644391      cpu-clock (msec)                                            
                 2      context-switches                                            
                 1      cpu-migrations                                              

       0.001031207 seconds time elapsed
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34981955

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档