* [PATCH] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
@ 2011-03-25 19:11 David Ahern
2011-03-30 7:16 ` [tip:perf/core] " tip-bot for David Ahern
0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2011-03-25 19:11 UTC (permalink / raw)
To: linux-perf-users, linux-kernel
Cc: acme, mingo, peterz, fweisbec, paulus, tglx, David Ahern
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.
Signed-off-by: David Ahern <daahern@cisco.com>
---
tools/perf/builtin-record.c | 7 +++++++
tools/perf/builtin-top.c | 8 ++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6febcc1..cac275e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -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));
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 80c9e06..109e1a0 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -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",
--
1.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* [tip:perf/core] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
2011-03-25 19:11 [PATCH] perf tools: Emit clearer message for sys_perf_event_open ENOENT return David Ahern
@ 2011-03-30 7:16 ` tip-bot for David Ahern
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for David Ahern @ 2011-03-30 7:16 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, paulus, hpa, mingo, peterz, fweisbec, tglx,
daahern, mingo
Commit-ID: ca6a42586fae639ff9e5285d9bdc550fcb1b8d41
Gitweb: http://git.kernel.org/tip/ca6a42586fae639ff9e5285d9bdc550fcb1b8d41
Author: David Ahern <daahern@cisco.com>
AuthorDate: Fri, 25 Mar 2011 13:11:11 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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 <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>
---
tools/perf/builtin-record.c | 10 +++++++++-
tools/perf/builtin-top.c | 6 ++++++
2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 623695e..db6adec 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -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));
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 935fc4f..fc1273e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -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"
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-30 7:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-25 19:11 [PATCH] perf tools: Emit clearer message for sys_perf_event_open ENOENT return David Ahern
2011-03-30 7:16 ` [tip:perf/core] " tip-bot for David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox