diff options
author | David Ahern <daahern@cisco.com> | 2011-03-25 15:11:11 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-03-29 12:40:27 -0400 |
commit | ca6a42586fae639ff9e5285d9bdc550fcb1b8d41 (patch) | |
tree | 0eeb89ae0aaf2654ca3dbdc8d8057b97fef69545 /tools/perf/builtin-record.c | |
parent | c286c419c784c238cd699be37fec7a9acc30d89f (diff) |
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 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 <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: David Ahern <daahern@cisco.com>
[ committer note: Some adjustments to make it apply to newer codebase ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 623695e18254..db6adecf46f1 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -301,11 +301,19 @@ try_again: | |||
301 | && attr->config == PERF_COUNT_HW_CPU_CYCLES) { | 301 | && attr->config == PERF_COUNT_HW_CPU_CYCLES) { |
302 | 302 | ||
303 | if (verbose) | 303 | if (verbose) |
304 | warning(" ... trying to fall back to cpu-clock-ticks\n"); | 304 | ui__warning("The cycles event is not supported, " |
305 | "trying to fall back to cpu-clock-ticks\n"); | ||
305 | attr->type = PERF_TYPE_SOFTWARE; | 306 | attr->type = PERF_TYPE_SOFTWARE; |
306 | attr->config = PERF_COUNT_SW_CPU_CLOCK; | 307 | attr->config = PERF_COUNT_SW_CPU_CLOCK; |
307 | goto try_again; | 308 | goto try_again; |
308 | } | 309 | } |
310 | |||
311 | if (err == ENOENT) { | ||
312 | ui__warning("The %s event is not supported.\n", | ||
313 | event_name(pos)); | ||
314 | exit(EXIT_FAILURE); | ||
315 | } | ||
316 | |||
309 | printf("\n"); | 317 | printf("\n"); |
310 | error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n", | 318 | error("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n", |
311 | err, strerror(err)); | 319 | err, strerror(err)); |