mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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>
This commit is contained in:
parent
279b5a85eb
commit
c9a8c343ef
|
|
@ -924,8 +924,10 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!has_supported_counters && !stat_config.null_run) {
|
if (!has_supported_counters && !stat_config.null_run) {
|
||||||
evsel__open_strerror(evlist__first(evsel_list), &target, open_err,
|
if (open_err) {
|
||||||
msg, sizeof(msg));
|
evsel__open_strerror(evlist__first(evsel_list), &target, open_err,
|
||||||
|
msg, sizeof(msg));
|
||||||
|
}
|
||||||
ui__error("No supported events found.\n%s\n", msg);
|
ui__error("No supported events found.\n%s\n", msg);
|
||||||
|
|
||||||
if (child_pid != -1)
|
if (child_pid != -1)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user