]> Gentwo Git Trees - linux/.git/commit
perf stat: When no events, don't report an error if there is none
authorIan Rogers <irogers@google.com>
Wed, 3 Dec 2025 21:47:04 +0000 (13:47 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 4 Dec 2025 08:36:14 +0000 (00:36 -0800)
commitc9a8c343ef2f9769a33650b7429f5a83ecba8380
treecd6975d71f15a2ad3ad603cc17daea28dba67852
parent279b5a85ebdd17b8e6713583d0ad6cf00f53eb10
perf stat: When no events, don't report an error if there is none

Events may fail to open as no supported CPUs were specified on the
command line. In this case a confusing "error" message of "success"
can be reported. Let's skip the error in that case.

Before:
```
$ perf stat -C2048 -e cycles -- true
WARNING: A requested CPU in '2048' is not supported by PMU 'cpu' (CPUs 0-7) for event 'cycles'
Error:
No supported events found.
The sys_perf_event_open() syscall returned with 0 (Success) for event (cpu/unknown-hardware/).
"dmesg | grep -i perf" may provide additional information.
```

After:
```
$ perf stat -C2048 -e cycles -- true
WARNING: A requested CPU in '2048' is not supported by PMU 'cpu' (CPUs 0-7) for event 'cycles'
Error:
No supported events found.
```

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-stat.c