All of lore.kernel.org
 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@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	kernel-team@lge.com
Subject: Re: [PATCH 3/6] perf report: Add -q/--quiet option
Date: Mon, 20 Feb 2017 16:08:01 -0300	[thread overview]
Message-ID: <20170220190801.GM4109@kernel.org> (raw)
In-Reply-To: <20170217081742.17417-4-namhyung@kernel.org>

Em Fri, Feb 17, 2017 at 05:17:39PM +0900, Namhyung Kim escreveu:
> The -q/--quiet option is to suppress any message.  Sometimes users just
> want to see the numbers and it can be used for that case.



#
# (Tip: Customize output of perf script with: perf script -F event,ip,sym)
#
(END)


This still appears, at the end :-\

- Arnaldo
 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/Documentation/perf-report.txt |  4 ++++
>  tools/perf/builtin-report.c              | 21 ++++++++++++++++-----
>  2 files changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
> index f2914f03ae7b..c04cc0647c16 100644
> --- a/tools/perf/Documentation/perf-report.txt
> +++ b/tools/perf/Documentation/perf-report.txt
> @@ -25,6 +25,10 @@ OPTIONS
>  --verbose::
>          Be more verbose. (show symbol address, etc)
>  
> +-q::
> +--quiet::
> +	Do not show any message.  (Suppress -v)
> +
>  -n::
>  --show-nr-samples::
>  	Show the number of samples for each symbol
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index dbd7fa028861..0a88670e56f3 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -320,6 +320,9 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
>  	size_t size = sizeof(buf);
>  	int socked_id = hists->socket_filter;
>  
> +	if (quiet)
> +		return 0;
> +
>  	if (symbol_conf.filter_relative) {
>  		nr_samples = hists->stats.nr_non_filtered_samples;
>  		nr_events = hists->stats.total_non_filtered_period;
> @@ -372,7 +375,11 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
>  {
>  	struct perf_evsel *pos;
>  
> -	fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples);
> +	if (!quiet) {
> +		fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n",
> +			evlist->stats.total_lost_samples);
> +	}
> +
>  	evlist__for_each_entry(evlist, pos) {
>  		struct hists *hists = evsel__hists(pos);
>  		const char *evname = perf_evsel__name(pos);
> @@ -382,7 +389,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
>  			continue;
>  
>  		hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
> -		hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout,
> +		hists__fprintf(hists, !quiet, 0, 0, rep->min_percent, stdout,
>  			       symbol_conf.use_callchain);
>  		fprintf(stdout, "\n\n");
>  	}
> @@ -716,6 +723,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
>  		    "input file name"),
>  	OPT_INCR('v', "verbose", &verbose,
>  		    "be more verbose (show symbol address, etc)"),
> +	OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
>  	OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
>  		    "dump raw trace in ASCII"),
>  	OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
> @@ -863,6 +871,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
>  		report.symbol_filter_str = argv[0];
>  	}
>  
> +	if (quiet)
> +		perf_quiet_option();
> +
>  	if (symbol_conf.vmlinux_name &&
>  	    access(symbol_conf.vmlinux_name, R_OK)) {
>  		pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
> @@ -983,14 +994,14 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
>  		goto error;
>  	}
>  
> -	if (report.header || report.header_only) {
> +	if ((report.header || report.header_only) && !quiet) {
>  		perf_session__fprintf_info(session, stdout,
>  					   report.show_full_info);
>  		if (report.header_only) {
>  			ret = 0;
>  			goto error;
>  		}
> -	} else if (use_browser == 0) {
> +	} else if (use_browser == 0 && !quiet) {
>  		fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
>  		      stdout);
>  	}
> @@ -1009,7 +1020,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
>   		 * providing it only in verbose mode not to bloat too
>   		 * much struct symbol.
>   		 */
> -		if (verbose) {
> +		if (verbose > 0) {
>  			/*
>  			 * XXX: Need to provide a less kludgy way to ask for
>  			 * more space per symbol, the u32 is for the index on
> -- 
> 2.11.1

  parent reply	other threads:[~2017-02-20 19:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17  8:17 [PATCHSET 0/6] perf tools: Add -q/--quiet option to suppress messages (v1) Namhyung Kim
2017-02-17  8:17 ` [PATCH 1/6] perf utils: Add perf_quiet_option() Namhyung Kim
2017-02-21  8:15   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 2/6] perf utils: Check verbose flag properly Namhyung Kim
2017-02-20 14:35   ` Arnaldo Carvalho de Melo
2017-02-21  1:38     ` Namhyung Kim
2017-02-21  8:16   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 3/6] perf report: Add -q/--quiet option Namhyung Kim
2017-02-17 11:09   ` Jiri Olsa
2017-02-19  0:21     ` Namhyung Kim
2017-02-20 19:08   ` Arnaldo Carvalho de Melo [this message]
2017-02-21  1:40     ` Namhyung Kim
2017-02-21  8:16   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 4/6] perf diff: " Namhyung Kim
2017-02-21  8:17   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 5/6] perf annotate: " Namhyung Kim
2017-02-21  8:17   ` [tip:perf/urgent] " tip-bot for Namhyung Kim
2017-02-17  8:17 ` [PATCH 6/6] perf record: Honor quiet option properly Namhyung Kim
2017-02-21  8:18   ` [tip:perf/urgent] perf record: Honor --quiet " tip-bot for 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=20170220190801.GM4109@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.