Skip to content

Commit

Permalink
perf tools: Emit clearer message for sys_perf_event_open ENOENT return
Browse files Browse the repository at this point in the history
Resend of patch sent back in January 2011 in light of recent confusion around
unsupported events for a given platform.

Improve sys_perf_event_open ENOENT return handling in top and record, just
like 5a3446b does for stat.

Retry of Arnaldo's patch using ui_warning instead of die which allows the
fallback from hardware cycles to software clock.

Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: David Ahern <[email protected]>
[ committer note: Some adjustments to make it apply to newer codebase ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
David Ahern authored and acmel committed Mar 29, 2011
1 parent c286c41 commit ca6a425
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,19 @@ static void open_counters(struct perf_evlist *evlist)
&& attr->config == PERF_COUNT_HW_CPU_CYCLES) {

if (verbose)
warning(" ... trying to fall back to cpu-clock-ticks\n");
ui__warning("The cycles event is not supported, "
"trying to fall back to cpu-clock-ticks\n");
attr->type = PERF_TYPE_SOFTWARE;
attr->config = PERF_COUNT_SW_CPU_CLOCK;
goto try_again;
}

if (err == ENOENT) {
ui__warning("The %s event is not supported.\n",
event_name(pos));
exit(EXIT_FAILURE);
}

printf("\n");
error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n",
err, strerror(err));
Expand Down
6 changes: 6 additions & 0 deletions tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,12 @@ static void start_counters(struct perf_evlist *evlist)
goto try_again;
}

if (err == ENOENT) {
ui__warning("The %s event is not supported.\n",
event_name(counter));
goto out_err;
}

ui__warning("The sys_perf_event_open() syscall "
"returned with %d (%s). /bin/dmesg "
"may provide additional information.\n"
Expand Down

0 comments on commit ca6a425

Please sign in to comment.