From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751558AbdBUIRk (ORCPT ); Tue, 21 Feb 2017 03:17:40 -0500 Received: from terminus.zytor.com ([65.50.211.136]:56440 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbdBUIRa (ORCPT ); Tue, 21 Feb 2017 03:17:30 -0500 Date: Tue, 21 Feb 2017 00:17:19 -0800 From: tip-bot for Namhyung Kim Message-ID: Cc: a.p.zijlstra@chello.nl, mingo@kernel.org, acme@redhat.com, hpa@zytor.com, namhyung@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, jolsa@kernel.org Reply-To: jolsa@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, hpa@zytor.com, namhyung@kernel.org, mingo@kernel.org, acme@redhat.com, a.p.zijlstra@chello.nl In-Reply-To: <20170217081742.17417-5-namhyung@kernel.org> References: <20170217081742.17417-5-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf diff: Add -q/--quiet option Git-Commit-ID: 63b42fce864a468ee02e6647474c4df9bfdc6166 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 63b42fce864a468ee02e6647474c4df9bfdc6166 Gitweb: http://git.kernel.org/tip/63b42fce864a468ee02e6647474c4df9bfdc6166 Author: Namhyung Kim AuthorDate: Fri, 17 Feb 2017 17:17:40 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 20 Feb 2017 11:47:08 -0300 perf diff: Add -q/--quiet option 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. Committer notes: Before: # perf diff | head -10 Failed to open /tmp/perf-6678.map, continuing without symbols Failed to open /tmp/perf-6678.map, continuing without symbols Failed to open /tmp/perf-2646.map, continuing without symbols # Event 'cycles' # # Baseline Delta Abs Shared Object Symbol # ........ ......... .......................... ............................................ # 5.36% -1.76% [kernel.vmlinux] [k] intel_idle 2.80% +1.48% firefox [.] 0x00000000000101fe 57.12% -1.25% libxul.so [.] 0x00000000009bea92 1.36% -1.11% [kernel.vmlinux] [k] __schedule 4.26% -1.00% perf-6678.map [.] 0x00007fac4b0e9320 After: # perf diff -q | head -10 5.36% -1.76% [kernel.vmlinux] [k] intel_idle 2.80% +1.48% firefox [.] 0x00000000000101fe 57.12% -1.25% libxul.so [.] 0x00000000009bea92 1.36% -1.11% [kernel.vmlinux] [k] __schedule 4.26% -1.00% perf-6678.map [.] 0x00007fac4b0e9320 1.86% +0.95% [kernel.vmlinux] [k] update_blocked_averages 0.80% -0.70% [kernel.vmlinux] [k] native_sched_clock 0.74% -0.58% [kernel.vmlinux] [k] native_write_msr 0.76% -0.56% qemu-system-x86_64 [.] 0x00000000002395c0 +0.54% libpulsecommon-10.0.so [.] 0x000000000002d91b # Signed-off-by: Namhyung Kim Suggested-and-Tested-by: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Peter Zijlstra Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170217081742.17417-5-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/perf-diff.txt | 4 ++++ tools/perf/builtin-diff.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index 66dbe3de..a79c84a 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt @@ -73,6 +73,10 @@ OPTIONS Be verbose, for instance, show the raw counts in addition to the diff. +-q:: +--quiet:: + Do not show any message. (Suppress -v) + -f:: --force:: Don't do ownership validation. diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 7ad0d78..1b96a31 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -691,7 +691,7 @@ static void hists__process(struct hists *hists) hists__precompute(hists); hists__output_resort(hists, NULL); - hists__fprintf(hists, true, 0, 0, 0, stdout, + hists__fprintf(hists, !quiet, 0, 0, 0, stdout, symbol_conf.use_callchain); } @@ -739,12 +739,14 @@ static void data_process(void) hists__link(hists_base, hists); } - fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", - perf_evsel__name(evsel_base)); + if (!quiet) { + fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", + perf_evsel__name(evsel_base)); + } first = false; - if (verbose > 0 || data__files_cnt > 2) + if (verbose > 0 || ((data__files_cnt > 2) && !quiet)) data__fprintf(); /* Don't sort callchain for perf diff */ @@ -807,6 +809,7 @@ static const char * const diff_usage[] = { static const struct option options[] = { OPT_INCR('v', "verbose", &verbose, "be more verbose (show symbol address, etc)"), + OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"), OPT_BOOLEAN('b', "baseline-only", &show_baseline_only, "Show only items with match in baseline"), OPT_CALLBACK('c', "compute", &compute, @@ -1328,6 +1331,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) argc = parse_options(argc, argv, options, diff_usage, 0); + if (quiet) + perf_quiet_option(); + if (symbol__init(NULL) < 0) return -1;