From: Ramkumar Ramachandra <artagnon@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, David Ahern <dsahern@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH] perf list: Replace --raw-dump with parse_options_subcommand()
Date: Wed, 26 Mar 2014 20:04:49 -0400 [thread overview]
Message-ID: <1395878689-6981-1-git-send-email-artagnon@gmail.com> (raw)
While adding usage information, 44d742e (perf list: Add usage,
2013-10-30) broke
$ perf list --raw-dump
Remove this option, and use parse_options_subcommand() to provide a
'--list-cmds'. The argument to 'perf list' is now treated like a
subcommand. Update the completion script to reflect this change.
Fixes: 44d742e01e6d (perf list: Add usage)
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
tools/perf/builtin-list.c | 13 +++++++------
tools/perf/perf-completion.sh | 6 +++---
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 011195e..4e9e4e3 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -22,13 +22,16 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
const struct option list_options[] = {
OPT_END()
};
- const char * const list_usage[] = {
- "perf list [hw|sw|cache|tracepoint|pmu|event_glob]",
+ const char *const list_subcommands[] = { "hw", "sw", "cache", "tracepoint",
+ "pmu", NULL };
+
+ const char *list_usage[] = {
+ "perf list {hw|sw|cache|tracepoint|pmu|event_glob}",
NULL
};
- argc = parse_options(argc, argv, list_options, list_usage,
- PARSE_OPT_STOP_AT_NON_OPTION);
+ argc = parse_options_subcommand(argc, argv, list_options, list_subcommands,
+ list_usage, PARSE_OPT_STOP_AT_NON_OPTION);
setup_pager();
@@ -53,8 +56,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;
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index ae3a576..a1f867b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -119,10 +119,10 @@ __perf_main ()
fi
# List possible events for -e option
elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
- evts=$($cmd list --raw-dump)
+ evts=$($cmd list --list-cmds)
__perfcomp_colon "$evts" "$cur"
- # List subcommands for 'perf kvm'
- elif [[ $prev == "kvm" ]]; then
+ # List subcommands for perf commands
+ elif [[ $prev == @(kvm|list) ]]; then
subcmds=$($cmd $prev --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
# List long option names
--
1.9.0.431.g014438b
next reply other threads:[~2014-03-27 0:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 0:04 Ramkumar Ramachandra [this message]
2014-03-27 21:20 ` Ramkumar Ramachandra
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=1395878689-6981-1-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=acme@redhat.com \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®