mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Borislav Petkov <bp@suse.de>,
	Brendan Gregg <brendan.d.gregg@gmail.com>,
	Chandler Carruth <chandlerc@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Stephane Eranian <eranian@google.com>,
	Wang Nan <wangnan0@huawei.com>
Subject: Re: [PATCH 1/2] perf tools: Setup pager when printing usage and help
Date: Thu, 22 Oct 2015 11:41:01 -0300	[thread overview]
Message-ID: <20151022144101.GE2455@kernel.org> (raw)
In-Reply-To: <1445524112-5201-1-git-send-email-namhyung@kernel.org>

Em Thu, Oct 22, 2015 at 11:28:31PM +0900, Namhyung Kim escreveu:
> It's annoying to see error or help message when command has many options
> like in perf record, report or top.  So setup pager when print parser
> error or help message - it should be OK since no UI is enabled at the
> parsing time.  The usage_with_options() already disables it by calling
> exit_browser() anyway.

But then we don't know what went wrong, try:

[acme@zoo linux]$ perf record --all-cpus -g --42 --event cycles 2>&1 | head
  Error: unknown option `42'

 Usage: perf record [<options>] [<command>]
    or: perf record [<options>] -- <command> [<options>]

    -e, --event <event>   event selector. use 'perf list' to list
available events
        --filter <filter>
                          event filter
        --exclude-perf    don't record events from perf itself
    -p, --pid <pid>       record events on existing process id
[acme@zoo linux]$

Without this patch I can see what was the option that caused the problem
(--42 in this case), after the patch I can see only the valid options,
not the one causing the problem, well, I can see it only if I use the
same 2>&1 technique above.

- Arnaldo
 
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
> Cc: Chandler Carruth <chandlerc@gmail.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Wang Nan <wangnan0@huawei.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/util/parse-options.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
> index 8aa7922397a9..388d385df5ad 100644
> --- a/tools/perf/util/parse-options.c
> +++ b/tools/perf/util/parse-options.c
> @@ -648,6 +648,8 @@ int usage_with_options_internal(const char * const *usagestr,
>  	if (!usagestr)
>  		return PARSE_OPT_HELP;
>  
> +	setup_pager();
> +
>  	fprintf(stderr, "\n Usage: %s\n", *usagestr++);
>  	while (*usagestr && **usagestr)
>  		fprintf(stderr, "    or: %s\n", *usagestr++);
> -- 
> 2.6.0

  parent reply	other threads:[~2015-10-22 14:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22 14:28 Namhyung Kim
2015-10-22 14:28 ` [PATCH 2/2] perf tools: Improve call graph documents and help messages Namhyung Kim
2015-10-22 14:46   ` Arnaldo Carvalho de Melo
2015-10-22 16:05     ` Namhyung Kim
2015-10-22 16:26       ` Arnaldo Carvalho de Melo
2015-10-22 16:28   ` Frederic Weisbecker
2015-10-22 18:37   ` Arnaldo Carvalho de Melo
2015-10-23  8:31   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-10-23  9:03     ` Ingo Molnar
2015-10-24 15:52       ` Namhyung Kim
2015-10-25  9:19         ` Ingo Molnar
2015-10-22 14:41 ` Arnaldo Carvalho de Melo [this message]
2015-10-22 15:58   ` [PATCH 1/2] perf tools: Setup pager when printing usage and help 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=20151022144101.GE2455@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=brendan.d.gregg@gmail.com \
    --cc=chandlerc@gmail.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.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

Powered by JetHome