public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 2] Two small UI tweaks to perf
@ 2009-10-27  0:33 Marti Raudsepp
  2009-10-27  0:33 ` [PATCH 1 of 2] perf tools: notify user when unrecognized event is specified Marti Raudsepp
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Marti Raudsepp @ 2009-10-27  0:33 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Marti Raudsepp, Peter Zijlstra, Paul Mackerras, linux-kernel

Hi!

Posting two small user interface tweaks to perf.

[PATCH 1 of 2] perf tools: notify user when unrecognized event is specified

When you specify an unknown --event, perf now outputs:

  invalid or unsupported event: 'foobar'
  Run 'perf list' for a list of valid events

[PATCH 2 of 2] perf tools: output 'perf list' to stdout not stderr

I certainly expected 'perf list' output to be sent to stdout. It's not errors
or notices: the user asked for a list.

Marti


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

* [PATCH 1 of 2] perf tools: notify user when unrecognized event is specified
  2009-10-27  0:33 [PATCH 0 of 2] Two small UI tweaks to perf Marti Raudsepp
@ 2009-10-27  0:33 ` Marti Raudsepp
  2009-10-27 13:54   ` [tip:perf/core] perf tools: Notify " tip-bot for Marti Raudsepp
  2009-10-27  0:33 ` [PATCH 2 of 2] perf tools: output 'perf list' to stdout not stderr Marti Raudsepp
  2009-10-27 13:52 ` [PATCH 0 of 2] Two small UI tweaks to perf Ingo Molnar
  2 siblings, 1 reply; 6+ messages in thread
From: Marti Raudsepp @ 2009-10-27  0:33 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Marti Raudsepp, Peter Zijlstra, Paul Mackerras, linux-kernel

Previously no indication was given about what went wrong.

Signed-off-by: Marti Raudsepp <marti@juffo.org>

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -677,6 +677,8 @@
 	if (ret != EVT_FAILED)
 		goto modifier;
 
+	fprintf(stderr, "invalid or unsupported event: '%s'\n", *str);
+	fprintf(stderr, "Run 'perf list' for a list of valid events\n");
 	return EVT_FAILED;
 
 modifier:

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

* [PATCH 2 of 2] perf tools: output 'perf list' to stdout not stderr
  2009-10-27  0:33 [PATCH 0 of 2] Two small UI tweaks to perf Marti Raudsepp
  2009-10-27  0:33 ` [PATCH 1 of 2] perf tools: notify user when unrecognized event is specified Marti Raudsepp
@ 2009-10-27  0:33 ` Marti Raudsepp
  2009-10-27 13:54   ` [tip:perf/core] perf tools: Output " tip-bot for Marti Raudsepp
  2009-10-27 13:52 ` [PATCH 0 of 2] Two small UI tweaks to perf Ingo Molnar
  2 siblings, 1 reply; 6+ messages in thread
From: Marti Raudsepp @ 2009-10-27  0:33 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Marti Raudsepp, Peter Zijlstra, Paul Mackerras, linux-kernel

Writing to stdout is probably the expected behavior because the user
explicitly asked for a list.

Signed-off-by: Marti Raudsepp <marti@juffo.org>

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -784,7 +784,7 @@
 		for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
 			snprintf(evt_path, MAXPATHLEN, "%s:%s",
 				 sys_dirent.d_name, evt_dirent.d_name);
-			fprintf(stderr, "  %-42s [%s]\n", evt_path,
+			printf("  %-42s [%s]\n", evt_path,
 				event_type_descriptors[PERF_TYPE_TRACEPOINT+1]);
 		}
 		closedir(evt_dir);
@@ -801,8 +801,8 @@
 	unsigned int i, type, op, prev_type = -1;
 	char name[40];
 
-	fprintf(stderr, "\n");
-	fprintf(stderr, "List of pre-defined events (to be used in -e):\n");
+	printf("\n");
+	printf("List of pre-defined events (to be used in -e):\n");
 
 	for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) {
 		type = syms->type + 1;
@@ -810,19 +810,19 @@
 			type = 0;
 
 		if (type != prev_type)
-			fprintf(stderr, "\n");
+			printf("\n");
 
 		if (strlen(syms->alias))
 			sprintf(name, "%s OR %s", syms->symbol, syms->alias);
 		else
 			strcpy(name, syms->symbol);
-		fprintf(stderr, "  %-42s [%s]\n", name,
+		printf("  %-42s [%s]\n", name,
 			event_type_descriptors[type]);
 
 		prev_type = type;
 	}
 
-	fprintf(stderr, "\n");
+	printf("\n");
 	for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) {
 		for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) {
 			/* skip invalid cache type */
@@ -830,17 +830,17 @@
 				continue;
 
 			for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
-				fprintf(stderr, "  %-42s [%s]\n",
+				printf("  %-42s [%s]\n",
 					event_cache_name(type, op, i),
 					event_type_descriptors[4]);
 			}
 		}
 	}
 
-	fprintf(stderr, "\n");
-	fprintf(stderr, "  %-42s [raw hardware event descriptor]\n",
+	printf("\n");
+	printf("  %-42s [raw hardware event descriptor]\n",
 		"rNNN");
-	fprintf(stderr, "\n");
+	printf("\n");
 
 	print_tracepoint_events();
 

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

* Re: [PATCH 0 of 2] Two small UI tweaks to perf
  2009-10-27  0:33 [PATCH 0 of 2] Two small UI tweaks to perf Marti Raudsepp
  2009-10-27  0:33 ` [PATCH 1 of 2] perf tools: notify user when unrecognized event is specified Marti Raudsepp
  2009-10-27  0:33 ` [PATCH 2 of 2] perf tools: output 'perf list' to stdout not stderr Marti Raudsepp
@ 2009-10-27 13:52 ` Ingo Molnar
  2 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2009-10-27 13:52 UTC (permalink / raw)
  To: Marti Raudsepp; +Cc: Peter Zijlstra, Paul Mackerras, linux-kernel


* Marti Raudsepp <marti@juffo.org> wrote:

> Hi!
> 
> Posting two small user interface tweaks to perf.
> 
> [PATCH 1 of 2] perf tools: notify user when unrecognized event is specified
> 
> When you specify an unknown --event, perf now outputs:
> 
>   invalid or unsupported event: 'foobar'
>   Run 'perf list' for a list of valid events

ok, agreed!

> [PATCH 2 of 2] perf tools: output 'perf list' to stdout not stderr
> 
> I certainly expected 'perf list' output to be sent to stdout. It's not errors
> or notices: the user asked for a list.

Certainly - i meant to fix this for some time - thanks for taking care 
of it.

	Ingo

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

* [tip:perf/core] perf tools: Notify user when unrecognized event is specified
  2009-10-27  0:33 ` [PATCH 1 of 2] perf tools: notify user when unrecognized event is specified Marti Raudsepp
@ 2009-10-27 13:54   ` tip-bot for Marti Raudsepp
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Marti Raudsepp @ 2009-10-27 13:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, marti, tglx,
	mingo

Commit-ID:  85df6f683efa457440eb922272fd5a71aa022ad4
Gitweb:     http://git.kernel.org/tip/85df6f683efa457440eb922272fd5a71aa022ad4
Author:     Marti Raudsepp <marti@juffo.org>
AuthorDate: Tue, 27 Oct 2009 00:33:04 +0000
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 27 Oct 2009 14:52:31 +0100

perf tools: Notify user when unrecognized event is specified

Previously no indication was given about what went wrong.

Signed-off-by: Marti Raudsepp <marti@juffo.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <03ec9ee96f17cef05424.1256603584@localhost>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/parse-events.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index b097570..e9e6d5c 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -678,6 +678,8 @@ parse_event_symbols(const char **str, struct perf_event_attr *attr)
 	if (ret != EVT_FAILED)
 		goto modifier;
 
+	fprintf(stderr, "invalid or unsupported event: '%s'\n", *str);
+	fprintf(stderr, "Run 'perf list' for a list of valid events\n");
 	return EVT_FAILED;
 
 modifier:

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

* [tip:perf/core] perf tools: Output 'perf list' to stdout not stderr
  2009-10-27  0:33 ` [PATCH 2 of 2] perf tools: output 'perf list' to stdout not stderr Marti Raudsepp
@ 2009-10-27 13:54   ` tip-bot for Marti Raudsepp
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Marti Raudsepp @ 2009-10-27 13:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, paulus, hpa, mingo, a.p.zijlstra, marti, tglx,
	mingo

Commit-ID:  689d30187828afe1faedf050b2f7593515b90c76
Gitweb:     http://git.kernel.org/tip/689d30187828afe1faedf050b2f7593515b90c76
Author:     Marti Raudsepp <marti@juffo.org>
AuthorDate: Tue, 27 Oct 2009 00:33:05 +0000
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 27 Oct 2009 14:52:32 +0100

perf tools: Output 'perf list' to stdout not stderr

Writing to stdout is probably the expected behavior because the
user explicitly asked for a list.

Signed-off-by: Marti Raudsepp <marti@juffo.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <4ebb59420ef057972167.1256603585@localhost>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/parse-events.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index e9e6d5c..31baa5a 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -806,7 +806,7 @@ static void print_tracepoint_events(void)
 		for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
 			snprintf(evt_path, MAXPATHLEN, "%s:%s",
 				 sys_dirent.d_name, evt_dirent.d_name);
-			fprintf(stderr, "  %-42s [%s]\n", evt_path,
+			printf("  %-42s [%s]\n", evt_path,
 				event_type_descriptors[PERF_TYPE_TRACEPOINT+1]);
 		}
 		closedir(evt_dir);
@@ -823,8 +823,8 @@ void print_events(void)
 	unsigned int i, type, op, prev_type = -1;
 	char name[40];
 
-	fprintf(stderr, "\n");
-	fprintf(stderr, "List of pre-defined events (to be used in -e):\n");
+	printf("\n");
+	printf("List of pre-defined events (to be used in -e):\n");
 
 	for (i = 0; i < ARRAY_SIZE(event_symbols); i++, syms++) {
 		type = syms->type + 1;
@@ -832,19 +832,19 @@ void print_events(void)
 			type = 0;
 
 		if (type != prev_type)
-			fprintf(stderr, "\n");
+			printf("\n");
 
 		if (strlen(syms->alias))
 			sprintf(name, "%s OR %s", syms->symbol, syms->alias);
 		else
 			strcpy(name, syms->symbol);
-		fprintf(stderr, "  %-42s [%s]\n", name,
+		printf("  %-42s [%s]\n", name,
 			event_type_descriptors[type]);
 
 		prev_type = type;
 	}
 
-	fprintf(stderr, "\n");
+	printf("\n");
 	for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) {
 		for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) {
 			/* skip invalid cache type */
@@ -852,17 +852,17 @@ void print_events(void)
 				continue;
 
 			for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) {
-				fprintf(stderr, "  %-42s [%s]\n",
+				printf("  %-42s [%s]\n",
 					event_cache_name(type, op, i),
 					event_type_descriptors[4]);
 			}
 		}
 	}
 
-	fprintf(stderr, "\n");
-	fprintf(stderr, "  %-42s [raw hardware event descriptor]\n",
+	printf("\n");
+	printf("  %-42s [raw hardware event descriptor]\n",
 		"rNNN");
-	fprintf(stderr, "\n");
+	printf("\n");
 
 	print_tracepoint_events();
 

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

end of thread, other threads:[~2009-10-27 13:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-27  0:33 [PATCH 0 of 2] Two small UI tweaks to perf Marti Raudsepp
2009-10-27  0:33 ` [PATCH 1 of 2] perf tools: notify user when unrecognized event is specified Marti Raudsepp
2009-10-27 13:54   ` [tip:perf/core] perf tools: Notify " tip-bot for Marti Raudsepp
2009-10-27  0:33 ` [PATCH 2 of 2] perf tools: output 'perf list' to stdout not stderr Marti Raudsepp
2009-10-27 13:54   ` [tip:perf/core] perf tools: Output " tip-bot for Marti Raudsepp
2009-10-27 13:52 ` [PATCH 0 of 2] Two small UI tweaks to perf Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox