perf tools: Emit clearer message for sys_perf_event_open ENOENT return
PATCH 1/1 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.
--- tools/perf/builtin-record.c | 7 +++++++ tools/perf/builtin-top.c | 8 ++++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
tools/perf/builtin-record.c +7 -0
@@ -282,6 +282,9 @@ try_again:else if (err ==ENODEV && cpu_list) {die ("No such device - did you specify" " an out-of-range profile CPU?\n" ); + }else if (err ==ENOENT ) { +ui__warning ("%s event is not supported.\n" , +event_name (pos)); }else if (err ==EINVAL && sample_id_all_avail) {/* * Old kernel, no attr->sample_id_type_all field
@@ -307,6 +310,10 @@ try_again: attr->config =PERF_COUNT_SW_CPU_CLOCK ; goto try_again; } + +if (err ==ENOENT ) +exit (1 ); +printf ("\n" );error ("sys_perf_event_open() syscall returned with %d (%s). /bin/dmesg may provide additional information.\n" , err,strerror (err));
tools/perf/builtin-top.c +8 -0
@@ -852,6 +852,10 @@ try_again:die ("Permission error - are you root?\n" "\t Consider tweaking" " /proc/sys/kernel/perf_event_paranoid.\n" ); + else if (err == ENOENT) + ui__warning("%s event is not supported.\n", + event_name(counter)); +/* * If it's cycles then fall back to hrtimer * based cpu-clock-tick sw counter, which
@@ -867,6 +871,10 @@ try_again: attr->config =PERF_COUNT_SW_CPU_CLOCK ; goto try_again; } + +if (err ==ENOENT ) +exit (1 ); +printf ("\n" ); error("sys_perf_event_open() syscall returned with %d " "(%s). /bin/dmesg may provide additional information.\n",
Signature · 1 line
1.7.4
Commit-ID: ca6a42586fae639ff9e5285d9bdc550fcb1b8d41 Gitweb: http://git.kernel.org/tip/ca6a42586fae639ff9e5285d9bdc550fcb1b8d41 Author: David Ahern <[email protected]> AuthorDate: Fri, 25 Mar 2011 13:11:11 -0600 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 29 Mar 2011 13:40:27 -0300
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 <[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]>
--- tools/perf/builtin-record.c | 10 +++++++++- tools/perf/builtin-top.c | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletions(-)
tools/perf/builtin-record.c +9 -1
@@ -301,11 +301,19 @@ try_again: && 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));
tools/perf/builtin-top.c +6 -0
@@ -870,6 +870,12 @@ 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 " "returned with %d (%s). /bin/dmesg " "may provide additional information.\n"