aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-diff.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2017-02-17 03:17:40 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-02-20 09:47:08 -0500
commit63b42fce864a468ee02e6647474c4df9bfdc6166 (patch)
tree9b64d6ef60dce47d1cb1f6ba9f0fea903c8c9e9f /tools/perf/builtin-diff.c
parent27fafab59a60b6f02491f2ff44cafd4f2335e487 (diff)
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 <namhyung@kernel.org> Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170217081742.17417-5-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-diff.c')
-rw-r--r--tools/perf/builtin-diff.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 7ad0d78ea743..1b96a3122228 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -691,7 +691,7 @@ static void hists__process(struct hists *hists)
691 hists__precompute(hists); 691 hists__precompute(hists);
692 hists__output_resort(hists, NULL); 692 hists__output_resort(hists, NULL);
693 693
694 hists__fprintf(hists, true, 0, 0, 0, stdout, 694 hists__fprintf(hists, !quiet, 0, 0, 0, stdout,
695 symbol_conf.use_callchain); 695 symbol_conf.use_callchain);
696} 696}
697 697
@@ -739,12 +739,14 @@ static void data_process(void)
739 hists__link(hists_base, hists); 739 hists__link(hists_base, hists);
740 } 740 }
741 741
742 fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", 742 if (!quiet) {
743 perf_evsel__name(evsel_base)); 743 fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n",
744 perf_evsel__name(evsel_base));
745 }
744 746
745 first = false; 747 first = false;
746 748
747 if (verbose > 0 || data__files_cnt > 2) 749 if (verbose > 0 || ((data__files_cnt > 2) && !quiet))
748 data__fprintf(); 750 data__fprintf();
749 751
750 /* Don't sort callchain for perf diff */ 752 /* Don't sort callchain for perf diff */
@@ -807,6 +809,7 @@ static const char * const diff_usage[] = {
807static const struct option options[] = { 809static const struct option options[] = {
808 OPT_INCR('v', "verbose", &verbose, 810 OPT_INCR('v', "verbose", &verbose,
809 "be more verbose (show symbol address, etc)"), 811 "be more verbose (show symbol address, etc)"),
812 OPT_BOOLEAN('q', "quiet", &quiet, "Do not show any message"),
810 OPT_BOOLEAN('b', "baseline-only", &show_baseline_only, 813 OPT_BOOLEAN('b', "baseline-only", &show_baseline_only,
811 "Show only items with match in baseline"), 814 "Show only items with match in baseline"),
812 OPT_CALLBACK('c', "compute", &compute, 815 OPT_CALLBACK('c', "compute", &compute,
@@ -1328,6 +1331,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused)
1328 1331
1329 argc = parse_options(argc, argv, options, diff_usage, 0); 1332 argc = parse_options(argc, argv, options, diff_usage, 0);
1330 1333
1334 if (quiet)
1335 perf_quiet_option();
1336
1331 if (symbol__init(NULL) < 0) 1337 if (symbol__init(NULL) < 0)
1332 return -1; 1338 return -1;
1333 1339