Skip to content

Commit

Permalink
perf stat: better error message for unsupported events
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: [email protected]
LPU-Reference: <[email protected]>
Signed-off-by: David Ahern <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
David Ahern authored and acmel committed Jan 10, 2011
1 parent e462dc5 commit 5a3446b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/perf/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ static int run_perf_stat(int argc __used, const char **argv)
"\t Consider tweaking"
" /proc/sys/kernel/perf_event_paranoid or running as root.",
system_wide ? "system-wide " : "");
} else if (errno == ENOENT) {
error("%s event is not supported. ", event_name(counter));
} else {
error("open_counter returned with %d (%s). "
"/bin/dmesg may provide additional information.\n",
Expand Down

0 comments on commit 5a3446b

Please sign in to comment.