Commit ca6a4258 authored by David Ahern's avatar David Ahern Committed by Arnaldo Carvalho de Melo

perf tools: Emit clearer message for sys_perf_event_open ENOENT return

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 5a3446bc 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 <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
LKML-Reference: <1301080271-20945-1-git-send-email-daahern@cisco.com>
Signed-off-by: default avatarDavid Ahern <daahern@cisco.com>
[ committer note: Some adjustments to make it apply to newer codebase ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c286c419
...@@ -301,11 +301,19 @@ static void open_counters(struct perf_evlist *evlist) ...@@ -301,11 +301,19 @@ static void open_counters(struct perf_evlist *evlist)
&& attr->config == PERF_COUNT_HW_CPU_CYCLES) { && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
if (verbose) 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->type = PERF_TYPE_SOFTWARE;
attr->config = PERF_COUNT_SW_CPU_CLOCK; attr->config = PERF_COUNT_SW_CPU_CLOCK;
goto try_again; goto try_again;
} }
if (err == ENOENT) {
ui__warning("The %s event is not supported.\n",
event_name(pos));
exit(EXIT_FAILURE);
}
printf("\n"); printf("\n");
error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n", error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n",
err, strerror(err)); err, strerror(err));
......
...@@ -870,6 +870,12 @@ static void start_counters(struct perf_evlist *evlist) ...@@ -870,6 +870,12 @@ static void start_counters(struct perf_evlist *evlist)
goto try_again; 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 " ui__warning("The sys_perf_event_open() syscall "
"returned with %d (%s). /bin/dmesg " "returned with %d (%s). /bin/dmesg "
"may provide additional information.\n" "may provide additional information.\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment