public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH] perf list: fix --raw-dump
Date: Wed, 11 Dec 2013 14:02:18 -0700	[thread overview]
Message-ID: <52A8D2DA.7050409@gmail.com> (raw)
In-Reply-To: <1386756980-23121-1-git-send-email-artagnon@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

On 12/11/13, 3:16 AM, Ramkumar Ramachandra wrote:
> While adding usage information, 44d742e (perf list: Add usage,
> 2013-10-30) broke
>
>    $ perf list --raw-dump
>
> by asking parse_options() to stop at
> non-option (PARSE_OPT_STOP_AT_NON_OPTION), hence parsing the option
> --raw-dump and barfing. Ask it to keep unknown options
> unparsed (PARSE_OPT_KEEP_UNKNOWN) so that we have a chance to handle it
> later. The trade-off that this patch makes is that
>
>    $ perf list --foo
>
> will not error out like it used to.

Why not make raw_dump a proper argument?


[-- Attachment #2: 0001-perf-list-Fix-raw-dump-arg.patch --]
[-- Type: text/plain, Size: 1678 bytes --]

>From b4444edaeffba7ebc459ee1b2cbe4f9cbd057476 Mon Sep 17 00:00:00 2001
From: David Ahern <dsahern@gmail.com>
Date: Wed, 11 Dec 2013 14:00:20 -0700
Subject: [PATCH] perf list: Fix raw-dump arg

Ramkumar reported that perf list --raw-dump was broken by 44d742e.
Fix by making raw-dump a proper argument.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>
---
 tools/perf/builtin-list.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 011195e38f21..b553d0c4ca82 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -19,7 +19,9 @@
 int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	int i;
+	bool raw_dump = false;
 	const struct option list_options[] = {
+		OPT_BOOLEAN(0, "raw-dump", &raw_dump, "raw dump for completion"),
 		OPT_END()
 	};
 	const char * const list_usage[] = {
@@ -36,6 +38,10 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 		print_events(NULL, false);
 		return 0;
 	}
+	if (raw_dump) {
+		print_events(NULL, true);
+		return 0;
+	}
 
 	for (i = 0; i < argc; ++i) {
 		if (i)
@@ -53,8 +59,6 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 			print_hwcache_events(NULL, false);
 		else if (strcmp(argv[i], "pmu") == 0)
 			print_pmu_events(NULL, false);
-		else if (strcmp(argv[i], "--raw-dump") == 0)
-			print_events(NULL, true);
 		else {
 			char *sep = strchr(argv[i], ':'), *s;
 			int sep_idx;
-- 
1.8.3.4 (Apple Git-47)


  reply	other threads:[~2013-12-11 21:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 10:16 [PATCH] perf list: fix --raw-dump Ramkumar Ramachandra
2013-12-11 21:02 ` David Ahern [this message]
2013-12-12  7:34   ` Ramkumar Ramachandra
2013-12-12 16:55     ` David Ahern
2013-12-16 13:19     ` Arnaldo Carvalho de Melo
2013-12-29 10:11       ` Ramkumar Ramachandra
2013-12-30 15:51         ` Dongsheng Yang
2013-12-16 16:07     ` Dongsheng Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52A8D2DA.7050409@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@redhat.com \
    --cc=artagnon@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox