Skip to content

Commit 5a3446b

Browse files
David Ahernacmel
authored andcommitted
perf stat: better error message for unsupported events
For unsupported events (e.g., H/W events when running in a VM) perf stat currently fails with the error message: Error: open_counter returned with 2 (No such file or directory). /bin/dmesg may provide additional information. Fatal: Not all events could be opened. dmesg is of no help and it is not clear as to why it fails to open the counter. This patch changes the error message to Error: cache-misses event is not supported. Fatal: Not all events could be opened. Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: a.p.zijlstra@chello.nl LPU-Reference: <1294597272-17335-1-git-send-email-daahern@cisco.com> Signed-off-by: David Ahern <daahern@cisco.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent e462dc5 commit 5a3446b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎tools/perf/builtin-stat.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ static int run_perf_stat(int argc __used, const char **argv)
316316
"\t Consider tweaking"
317317
" /proc/sys/kernel/perf_event_paranoid or running as root.",
318318
system_wide ? "system-wide " : "");
319+
} else if (errno == ENOENT) {
320+
error("%s event is not supported. ", event_name(counter));
319321
} else {
320322
error("open_counter returned with %d (%s). "
321323
"/bin/dmesg may provide additional information.\n",

0 commit comments

Comments
 (0)