From: Namhyung Kim <namhyung@kernel.org>
To: Taesoo Kim <tsgatesv@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
linux-kernel@vger.kernel.org, taesoo@gatech.edu
Subject: Re: [PATCH 1/1] perf list: Fix --raw-dump option
Date: Mon, 29 Dec 2014 16:32:49 +0900 [thread overview]
Message-ID: <20141229073249.GB6081@sejong> (raw)
In-Reply-To: <1419654573-2340-1-git-send-email-tsgatesv@gmail.com>
Hi Taesoo,
On Fri, Dec 26, 2014 at 11:29:33PM -0500, Taesoo Kim wrote:
> Currently, 'perf list --raw-dump' requires extra arguments
> (e.g., hw) to invoke, which breaks bash/zsh completion
> (perf-completion.sh).
>
> $ perf list --raw-dump
> Error: unknown option `raw-dump'
>
> usage: perf list [hw|sw|cache|tracepoint|pmu|event_glob]
>
> After,
>
> $ perf list --raw-dump
> cpu-cycles instructions cache-references cache-misses ...
>
> Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
Thanks for fixing this. Actually the --raw-dump option is intended to
support shell completion and not to be used directly. I didn't update
the completion script for a while so didn't notice it. It seems like
recent updates of the option parsing code broke this.
> ---
> tools/perf/builtin-list.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
> index 011195e..ec76bee 100644
> --- a/tools/perf/builtin-list.c
> +++ b/tools/perf/builtin-list.c
> @@ -16,14 +16,17 @@
> #include "util/pmu.h"
> #include "util/parse-options.h"
>
> +static bool raw_dump = false;
> +
> int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
> {
> int i;
> const struct option list_options[] = {
> + OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"),
> OPT_END()
> };
> const char * const list_usage[] = {
> - "perf list [hw|sw|cache|tracepoint|pmu|event_glob]",
> + "perf list [hw|sw|cache|tracepoint|pmu|event_glob|--raw-dump]",
> NULL
> };
So I'd like to keep the usage string as is and mark the option as
hidden - i.e. using set_option_flag(list_options, 0, "raw-dump",
PARSE_OPT_HIDDEN) before calling to parse_options().
With that,
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
>
> @@ -32,6 +35,11 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
>
> setup_pager();
>
> + if (raw_dump) {
> + print_events(NULL, true);
> + return 0;
> + }
> +
> if (argc == 0) {
> print_events(NULL, false);
> return 0;
> @@ -53,8 +61,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;
> --
> 2.1.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2014-12-29 7:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-27 4:29 [PATCH 1/1] perf list: Fix --raw-dump option Taesoo Kim
2014-12-29 7:32 ` Namhyung Kim [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-12-29 17:02 Taesoo Kim
2014-12-30 22:49 ` Arnaldo Carvalho de Melo
2014-12-31 3:36 Taesoo Kim
2014-12-31 3:53 ` Namhyung Kim
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=20141229073249.GB6081@sejong \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=taesoo@gatech.edu \
--cc=tsgatesv@gmail.com \
/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