linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
@ 2011-03-25 18:05 David Ahern
  2011-03-25 18:08 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2011-03-25 18:05 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 error 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 |    6 ++++++
 tools/perf/builtin-top.c    |    7 +++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6febcc1..73fa8b7 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -282,6 +282,8 @@ 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) {
+				error("%s event is not supported.", event_name(pos));
 			} else if (err == EINVAL && sample_id_all_avail) {
 				/*
 				 * Old kernel, no attr->sample_id_type_all field
@@ -307,6 +309,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..ab27693 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -852,6 +852,9 @@ try_again:
 				die("Permission error - are you root?\n"
 					"\t Consider tweaking"
 					" /proc/sys/kernel/perf_event_paranoid.\n");
+			else if (err == ENOENT)
+				error("%s event is not supported.", event_name(counter));
+
 			/*
 			 * If it's cycles then fall back to hrtimer
 			 * based cpu-clock-tick sw counter, which
@@ -867,6 +870,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] 5+ messages in thread

* Re: [PATCH] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
  2011-03-25 18:05 David Ahern
@ 2011-03-25 18:08 ` Arnaldo Carvalho de Melo
  2011-03-25 18:26   ` David Ahern
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-03-25 18:08 UTC (permalink / raw)
  To: David Ahern
  Cc: linux-perf-users, linux-kernel, mingo, peterz, fweisbec, paulus,
	tglx

Em Fri, Mar 25, 2011 at 12:05:50PM -0600, David Ahern escreveu:
> 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 error instead of die which allows the fallback
> from hardware cycles to software clock.

Please use ui__warning(""...) as it will work in the TUI too.
 
> Signed-off-by: David Ahern <daahern@cisco.com>
> ---
>  tools/perf/builtin-record.c |    6 ++++++
>  tools/perf/builtin-top.c    |    7 +++++++
>  2 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 6febcc1..73fa8b7 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -282,6 +282,8 @@ 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) {
> +				error("%s event is not supported.", event_name(pos));
>  			} else if (err == EINVAL && sample_id_all_avail) {
>  				/*
>  				 * Old kernel, no attr->sample_id_type_all field
> @@ -307,6 +309,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..ab27693 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -852,6 +852,9 @@ try_again:
>  				die("Permission error - are you root?\n"
>  					"\t Consider tweaking"
>  					" /proc/sys/kernel/perf_event_paranoid.\n");
> +			else if (err == ENOENT)
> +				error("%s event is not supported.", event_name(counter));
> +
>  			/*
>  			 * If it's cycles then fall back to hrtimer
>  			 * based cpu-clock-tick sw counter, which
> @@ -867,6 +870,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	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
  2011-03-25 18:08 ` Arnaldo Carvalho de Melo
@ 2011-03-25 18:26   ` David Ahern
  2011-03-25 18:37     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2011-03-25 18:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-perf-users, linux-kernel, mingo, peterz, fweisbec, paulus,
	tglx



On 03/25/11 12:08, Arnaldo Carvalho de Melo wrote:
> Em Fri, Mar 25, 2011 at 12:05:50PM -0600, David Ahern escreveu:
>> 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 error instead of die which allows the fallback
>> from hardware cycles to software clock.
> 
> Please use ui__warning(""...) as it will work in the TUI too.

error() is consistent with current pattern. Is ui__warning the
preference for new messages? Is that for perf-top only?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
  2011-03-25 18:26   ` David Ahern
@ 2011-03-25 18:37     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2011-03-25 18:37 UTC (permalink / raw)
  To: David Ahern
  Cc: linux-perf-users, linux-kernel, mingo, peterz, fweisbec, paulus,
	tglx

Em Fri, Mar 25, 2011 at 12:26:41PM -0600, David Ahern escreveu:
> On 03/25/11 12:08, Arnaldo Carvalho de Melo wrote:
> > Em Fri, Mar 25, 2011 at 12:05:50PM -0600, David Ahern escreveu:
> >> 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 error instead of die which allows the fallback
> >> from hardware cycles to software clock.
> > 
> > Please use ui__warning(""...) as it will work in the TUI too.
> 
> error() is consistent with current pattern. Is ui__warning the
> preference for new messages? Is that for perf-top only?

Yes, it is, it takes care of using TUI of doing it like error() does.
Eventually error(), etc will go away.

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] perf tools: Emit clearer message for sys_perf_event_open ENOENT return
@ 2011-03-25 19:11 David Ahern
  0 siblings, 0 replies; 5+ 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] 5+ messages in thread

end of thread, other threads:[~2011-03-25 19:11 UTC | newest]

Thread overview: 5+ 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
  -- strict thread matches above, loose matches on Subject: below --
2011-03-25 18:05 David Ahern
2011-03-25 18:08 ` Arnaldo Carvalho de Melo
2011-03-25 18:26   ` David Ahern
2011-03-25 18:37     ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).