linux - "perf stat"为 ARCH Linux ARM 上的所有事件返回 <not supported>

标签 linux perf

我的 perf 在运行 ARCH Linux ARM 的 Cortex-A15 Chromebook 上运行良好。

我更新了 pacman 以获得 gcc-5.3,它要求更新我的内核,所以我做了。

现在 perf 返回:

[cortex@alarm Speckle]$ perf stat uname -a
Linux alarm 3.8.11-3-ARCH #1 SMP Wed Jan 20 13:44:59 MST 2016 armv7l GNU/Linux

 Performance counter stats for 'uname -a':

   <not supported>      task-clock               
   <not supported>      context-switches         
   <not supported>      cpu-migrations           
   <not supported>      page-faults              
   <not supported>      cycles                   
   <not supported>      stalled-cycles-frontend  
   <not supported>      stalled-cycles-backend   
   <not supported>      instructions             
   <not supported>      branches                 
   <not supported>      branch-misses            

       0.002148765 seconds time elapsed

如果我运行 perf list,它告诉我它应该支持这些事件:

[cortex@alarm Speckle]$ perf list

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

  branch-instructions OR branches                    [Hardware event]
  branch-misses                                      [Hardware event]
  bus-cycles                                         [Hardware event]
  cache-misses                                       [Hardware event]
  cache-references                                   [Hardware event]
  cpu-cycles OR cycles                               [Hardware event]
  instructions                                       [Hardware event]
  ref-cycles                                         [Hardware event]

并且检查我的内核配置,似乎 perf 应该仍然被支持。

[cortex@alarm Speckle]$ zgrep PERF /proc/config.gz 
CONFIG_CGROUP_PERF=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_PERF_USE_VMALLOC=y
CONFIG_PERF_EVENTS=y
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
CONFIG_HW_PERF_EVENTS=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CLS_U32_PERF is not set
# CONFIG_DEVFREQ_GOV_PERFORMANCE is not set

如果我尝试 ocount/oprofile,它似乎有效:

[cortex@alarm ~]$ ocount --events INST_RETIRED  uname -a
Linux alarm 3.8.11-3-ARCH #1 SMP Wed Jan 20 13:44:59 MST 2016 armv7l GNU/Linux

Events were actively counted for 1598252 nanoseconds.
Event counts (actual) for /usr/bin/uname:
    Event                Count                    % time counted
    INST_RETIRED         609,518                  100.00

查看 pacman 的日志,好像这里就是内核变化发生的地方?

[2016-04-26 06:24] [ALPM] upgraded libtool (2.4.6-3 -> 2.4.6-4)
[2016-04-26 06:27] [ALPM] upgraded linux-firmware (20150904.6ebf5d5-1 -> 20160315.deb1d83-1)
[2016-04-26 06:27] [ALPM] upgraded linux-peach (3.8.11-2 -> 3.8.11-3)
[2016-04-26 06:27] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
[2016-04-26 06:27] [ALPM-SCRIPTLET] A new kernel version needs to be flashed onto /dev/sda1.
[2016-04-26 06:27] [ALPM-SCRIPTLET] Do you want to do this now? [y|N]
[2016-04-26 06:28] [ALPM-SCRIPTLET] 8752+0 records in
[2016-04-26 06:28] [ALPM-SCRIPTLET] 8752+0 records out
[2016-04-26 06:28] [ALPM-SCRIPTLET] 4481024 bytes (4.5 MB, 4.3 MiB) copied, 12.7236 s, 352 kB/s

我搞砸了什么,如何恢复 perf

最佳答案

我找到的解决方案是从 perf 4.5-2 降级到 perf 4.3-1

cd /var/cache/pacman/pkg/
sudo pacman -U perf-4.3-1-armv7h.pkg.tar.xz

运行 perf stat ls 现在返回我期望的计数器。

关于linux - "perf stat"为 ARCH Linux ARM 上的所有事件返回 <not supported>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36884535/

相关文章:

linux - 使用性能报告从特定的二进制文件中获取符号

c++ - 如何使用 linux perf 获取 libc6 符号(例如 _int_malloc)的调用父项?

java - 无限循环 : Java or Shell script

c - 如何检查内核中函数的性能

python - 多个 Phonon audioOutput 实例在 Linux 上不能正常工作?

linux - 不包括日志文件的 Zip 文件

perf - Google Benchmark 的性能计数器结果中的 'n' 、 'p' 和 'u' 代表什么?

linux - Perf 输出无法重定向到文件

linux - Bash 脚本生成空文件

r - 无法在 Redhat 上的 R 3.4.2 中安装 stringi 包