我正在尝试在我的机器上安装 PAPI:
$ uname -a
Linux XXXXXX 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
并且它没有检测到任何事件:
$ papi_avail
...
Of 108 possible events, 0 are available, of which 0 are derived.
No events detected! Check papi_component_avail to find out why.
$ papi_component_avail
Available components and hardware information.
--------------------------------------------------------------------------------
PAPI version : 7.0.1.0
Operating system : Linux 5.19.0-35-generic
Vendor string and code : GenuineIntel (1, 0x1)
Model string and code : 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (140, 0x8c)
CPU revision : 1.000000
CPUID : Family/Model/Stepping 6/140/1, 0x06/0x8c/0x01
CPU Max MHz : 4800
CPU Min MHz : 400
Total cores : 8
SMT threads per core : 2
Cores per socket : 4
Sockets : 1
Cores per NUMA region : 8
NUMA regions : 1
Running in a VM : no
Number Hardware Counters : 19
Max Multiplex Counters : 384
Fast counter read (rdpmc): yes
--------------------------------------------------------------------------------
Compiled-in components:
Name: perf_event Linux perf_event CPU counters
Name: perf_event_uncore Linux perf_event CPU uncore and northbridge
\-> Disabled: No uncore PMUs or events found
Name: sysdetect System info detection component
Active components:
Name: perf_event Linux perf_event CPU counters
Native: 165, Preset: 0, Counters: 19
PMUs supported: ix86arch, perf, perf_raw, icl
Name: sysdetect System info detection component
Native: 0, Preset: 0, Counters: 0
--------------------------------------------------------------------------------
我已 按照 Ubuntu 计算机的 INSTALL.txt 文件中的说明进行添加,并KERNEL=="perfctr", MODE="0666"
通过运行和设置/etc/udev/rules.d/40-permissions.rules
/proc/sys/kernel/perf_event_paranoid
-1
$ sudo sh -c "echo -1 > /proc/sys/kernel/perf_event_paranoid"
$ sudo sh -c 'echo kernel.perf_event_paranoid=-1 > /etc/sysctl.d/local.conf'
据我了解 papi 通过 perf 访问这些事件,大多数测试似乎都工作正常:
$ perf test
1: vmlinux symtab matches kallsyms : Skip
2: Detect openat syscall event : Skip (permissions)
3: Detect openat syscall event on all cpus : Skip (permissions)
4: Read samples using the mmap interface : Skip (permissions)
5: Test data source output : Ok
6: Parse event definition strings :
6.1: Test event parsing : Skip (permissions)
6.2: Test parsing of "hybrid" CPU events : Skip (not hybrid)
6.3: Parsing of all PMU events from sysfs : Ok
6.4: Parsing of given PMU events from sysfs : Ok
6.5: Parsing of aliased events from sysfs : Skip (no aliases in sysfs)
6.6: Parsing of aliased events : Ok
6.7: Parsing of terms (event modifiers) : Ok
7: Simple expression parser : Ok
8: PERF_RECORD_* events & perf_sample fields : Ok
9: Parse perf pmu format : Ok
10: PMU events :
10.1: PMU event table sanity : Ok
10.2: PMU event map aliases : Ok
10.3: Parsing of PMU event table metrics : Ok
10.4: Parsing of PMU event table metrics with fake PMUs: Ok
11: DSO data read : Ok
12: DSO data cache : Ok
13: DSO data reopen : Ok
14: Roundtrip evsel->name : Ok
15: Parse sched tracepoints fields : FAILED!
16: syscalls:sys_enter_openat event fields : FAILED!
17: Setup struct perf_event_attr : Skip
18: Match and link multiple hists : Ok
19: 'import perf' in python : Ok
20: Breakpoint overflow signal handler : Ok
21: Breakpoint overflow sampling : Ok
22: Breakpoint accounting : Ok
23: Watchpoint :
23.1: Read Only Watchpoint : Skip (missing hardware support)
23.2: Write Only Watchpoint : Ok
23.3: Read / Write Watchpoint : Ok
23.4: Modify Watchpoint : Ok
24: Number of exit events of a simple workload : Ok
25: Software clock events period values : Ok
26: Object code reading : FAILED!
27: Sample parsing : Ok
28: Use a dummy software event to keep tracking: Ok
29: Parse with no sample_id_all bit set : Ok
30: Filter hist entries : Ok
31: Lookup mmap thread : Ok
32: Share thread maps : Ok
33: Sort output of hist entries : Ok
34: Cumulate child hist entries : Ok
35: Track with sched_switch : Ok
36: Filter fds with revents mask in a fdarray : Ok
37: Add fd to a fdarray, making it autogrow : Ok
38: kmod_path__parse : Ok
39: Thread map : Ok
40: LLVM search and compile :
40.1: Basic BPF llvm compile : Skip
40.2: kbuild searching : Skip
40.3: Compile source for BPF prologue generation: Skip
40.4: Compile source for BPF relocation : Skip
41: Session topology : Ok
42: BPF filter :
42.1: Basic BPF filtering : Skip
42.2: BPF pinning : Skip (clang isn't installed or environment missing BPF support)
42.3: BPF prologue generation : Skip (clang isn't installed or environment missing BPF support)
43: Synthesize thread map : Ok
44: Remove thread map : Ok
45: Synthesize cpu map : Ok
46: Synthesize stat config : Ok
47: Synthesize stat : Ok
48: Synthesize stat round : Ok
49: Synthesize attr update : Ok
50: Event times : Ok
51: Read backward ring buffer : Skip
52: Print cpu map : Ok
53: Merge cpu map : Ok
54: Probe SDT events : Skip
55: is_printable_array : Ok
56: Print bitmap : Ok
57: perf hooks : Ok
58: builtin clang support :
58.1: builtin clang compile C source to IR : Skip (not compiled in)
58.2: builtin clang compile C source to ELF object: Skip (not compiled in)
59: unit_number__scnprintf : Ok
60: mem2node : Ok
61: time utils : Ok
62: Test jit_write_elf : Ok
63: Test libpfm4 support :
63.1: test of individual --pfm-events : Skip (not compiled in)
63.2: test groups of --pfm-events : Skip (not compiled in)
64: Test api io : Ok
65: maps__merge_in : Ok
66: Demangle Java : Ok
67: Demangle OCaml : Ok
68: Parse and process metrics : Ok
69: PE file support : Skip
70: Event expansion for cgroups : Ok
71: Convert perf time to TSC :
71.1: TSC support : Ok
71.2: Perf time to TSC : Ok
72: dlfilter C API : Skip
73: Sigtrap : Ok
74: x86 rdpmc : Ok
75: Test dwarf unwind : FAILED!
76: x86 instruction decoder - new instructions : Ok
77: Intel PT packet decoder : Ok
78: x86 bp modify : Ok
79: x86 Sample parsing : Ok
failed to open shell test directory: /usr/libexec/perf-core/tests/shell
我尝试检查 perf 版本,但我只得到:
$ perf --version
perf version
我还尝试通过 APT 和 git repo 安装 PAPI,但似乎表现完全相同。
我没有想法去尝试,所以任何有关我的配置可能出现问题的反馈将不胜感激