首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我不能使用power/energy-核/ perf事件修饰符

为什么我不能使用power/energy-核/ perf事件修饰符
EN

Stack Overflow用户
提问于 2017-10-13 08:08:39
回答 1查看 1.1K关注 0票数 2

我试图使用事件功率/能量核心/使用perf工具读取内核空间中系统的威力,命令如下:

代码语言:javascript
复制
perf stat -a -e power/energy-cores/:k -I 1000 sleep 10

:k是一个修饰符,它像本文档https://perf.wiki.kernel.org/index.php/Tutorial中所描述的那样,在内核空间中排列事件,但是当我使用这个:k时,我会得到下面的错误:

代码语言:javascript
复制
user@dkphome:/sys/bus/event_source/devices/cpu$ sudo perf stat -a -e
power/energy-cores/:k -I 1000 sleep 30
event syntax error: '..nergy-cores/:k'
                                   \___ parser error
Run 'perf list' for a list of valid events

  Usage: perf stat [<options>] [<command>]

     -e, --event <event>   event selector. use 'perf list' to list available events

首先,我认为这个事件不支持:k修饰符,但我做了其他测试,现在我认为这可能是一个bug,或者我试图使用错误的语法。为了测试它,我尝试了如下所示的其他事件:

缓存-错过事件可以通过两种方式调用:缓存丢失或cpu/缓存丢失/因此,我尝试使用修饰符。

代码语言:javascript
复制
user@dkphome:/sys/bus/event_source/devices/cpu$ sudo perf stat -a -e cache-misses:k -I 1000 sleep 5
#           time             counts unit events
     1.000429017            287.589      cache-misses:k                                              
     2.000828552            195.999      cache-misses:k                                              
     3.001086195            216.885      cache-misses:k                                              
     4.001438671            240.842      cache-misses:k                                              
     5.000702347            314.469      cache-misses:k                                              
user@dkphome:/sys/bus/event_source/devices/cpu$ sudo perf stat -a -e cpu/cache-misses/:k -I 1000 sleep 5
event syntax error: '..ache-misses/:k'
                                   \___ parser error
Run 'perf list' for a list of valid events

  Usage: perf stat [<options>] [<command>]

     -e, --event <event>   event selector. use 'perf list' to list available events
user@dkphome:/sys/bus/event_source/devices/cpu$ sudo perf stat -a -e cpu/cache-misses/ -I 1000 sleep 5
#           time             counts unit events
     1.000379149          1.949.866      cpu/cache-misses/                                           
     2.000628057          1.023.040      cpu/cache-misses/                                           
     3.000906500          1.284.476      cpu/cache-misses/                                           
     4.001197960            853.127      cpu/cache-misses/                                           
     5.000762257            722.242      cpu/cache-misses/ 

有人知道我如何在能量/能量核心/事件中使用:k修饰符?

结果:在没有正确答案的情况下工作,但不幸的是,对我来说,修饰符似乎不支持它。

代码语言:javascript
复制
user@dkphome:~$ sudo perf stat -a -e power/energy-cores/k -I 1000 sleep 5
#           time             counts unit events
     1.000099515    <not supported> Joules power/energy-cores/k                                        
     2.000246523    <not supported> Joules power/energy-cores/k                                        
     3.000440743    <not supported> Joules power/energy-cores/k                                        
     4.000673143    <not supported> Joules power/energy-cores/k                                        
     5.000722624    <not supported> Joules power/energy-cores/k                                        
user@dkphome:~$ sudo perf stat -a -e power/energy-cores/ -I 1000 sleep 5
 #           time             counts   unit events
     1.000128209               0,19 Joules power/energy-cores/                                         
     2.000257170               0,25 Joules power/energy-cores/                                         
     3.000406715               0,26 Joules power/energy-cores/                                         
     4.000571140               0,20 Joules power/energy-cores/                                         
     5.000711815               1,01 Joules power/energy-cores/                                         
     5.000882867               0,00 Joules power/energy-cores/                                         
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-13 21:08:20

通常,当您开始使用perf命令度量任何事件时,第一步是运行perf list并检查系统是否支持事件power/energy cores。我将给出一个在我的系统上运行perf列表的例子。

~/linux-4.11.3/tools/perf$ ./perf list

List of pre-defined events (to be used in -e):

branch-instructions OR branches [Hardware event]

branch-misses [Hardware event]

power/energy-cores/ [Kernel PMU event]

这样,您就可以确定事件功率/能量核心的测量是否实际上是由您的系统支持的。

一旦确认了这一点,就应该使用下面的语法来度量此事件:

./perf stat -a -e power/energy-cores/ -I 1000 sleep 30 (否:k :u)

编辑#1:

如果您可以指定事件power/energy-cores,则可以使用a :k或:u,如下所示:

./perf stat -a -e energy-cores:k -I 1000 sleep 30 (但是perf不能识别energy-cores事件,除非您指定完全限定的事件名,如:power/energy-cores)。

但是,正如我在第二版中所建议的,这些计数器无论如何都不支持用户空间和内核空间的分离。

编辑2:

不幸的是,这些RAPL计数器没有根据内核空间或用户空间分离值。此外,与这些事件有关的业绩监测股也不能进行抽样。

这是代码中的证据:

arch/x86/events/英特尔/rapl.c

此外,您还可以阅读下面的补丁文档以了解:

RAPL贴片

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

https://stackoverflow.com/questions/46725365

复制
相关文章

相似问题

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