Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1580187

[PATCH 04/15] perf diff: Add diff.compute config option

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 04/15] perf diff: Add diff.compute config option
Date 2017-02-14 02:20 +0100
Message-ID <tazWH-3d2-27@gated-at.bofh.it> (permalink)
References <tazWF-3d2-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Namhyung Kim <namhyung@kernel.org>

The diff.compute config variable is to set the default compute method of
perf diff command (-c option).  Possible values 'delta' (default),
'delta-abs', 'ratio' and 'wdiff'.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Taeung Song <treeze.taeung@gmail.com>
Link: http://lkml.kernel.org/r/20170210073614.24584-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-config.txt |  5 +++++
 tools/perf/Documentation/perf-diff.txt   |  5 +++--
 tools/perf/builtin-diff.c                | 16 +++++++++++++++-
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 49ab79d662fa..5b4fff3adc4b 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -505,6 +505,11 @@ diff.*::
 		Setting it to 1 will sort the result by delta (or other
 		compute method selected).
 
+	diff.compute::
+		This options sets the method for computing the diff result.
+		Possible values are 'delta', 'delta-abs', 'ratio' and
+		'wdiff'.  Default is 'delta'.
+
 SEE ALSO
 --------
 linkperf:perf[1]
diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt
index 7c014c9934bb..7391299defef 100644
--- a/tools/perf/Documentation/perf-diff.txt
+++ b/tools/perf/Documentation/perf-diff.txt
@@ -86,8 +86,9 @@ OPTIONS
 
 -c::
 --compute::
-        Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta).
-        See COMPARISON METHODS section for more info.
+        Differential computation selection - delta, ratio, wdiff, delta-abs
+        (default is delta).  Default can be changed using diff.compute
+        config option.  See COMPARISON METHODS section for more info.
 
 -p::
 --period::
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 181ff996e039..e68cc76bdc5a 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -86,7 +86,7 @@ const char *compute_names[COMPUTE_MAX] = {
 	[COMPUTE_WEIGHTED_DIFF] = "wdiff",
 };
 
-static int compute;
+static int compute = COMPUTE_DELTA;
 
 static int compute_2_hpp[COMPUTE_MAX] = {
 	[COMPUTE_DELTA]		= PERF_HPP_DIFF__DELTA,
@@ -1299,6 +1299,20 @@ static int diff__config(const char *var, const char *value,
 		sort_compute = perf_config_int(var, value);
 		return 0;
 	}
+	if (!strcmp(var, "diff.compute")) {
+		if (!strcmp(value, "delta")) {
+			compute = COMPUTE_DELTA;
+		} else if (!strcmp(value, "delta-abs")) {
+			compute = COMPUTE_DELTA_ABS;
+		} else if (!strcmp(value, "ratio")) {
+			compute = COMPUTE_RATIO;
+		} else if (!strcmp(value, "wdiff")) {
+			compute = COMPUTE_WEIGHTED_DIFF;
+		} else {
+			pr_err("Invalid compute method: %s\n", value);
+			return -1;
+		}
+	}
 
 	return 0;
 }
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 02:20 +0100
  [PATCH 04/15] perf diff: Add diff.compute config option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 02:20 +0100
  [PATCH 11/15] perf tests record: No need to test an array against NULL Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 02:20 +0100
  [PATCH 08/15] tools lib traceevent plugin function: Initialize 'index' variable Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 02:20 +0100
  [PATCH 14/15] samples/bpf: Ignore already processed ELF sections Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 02:20 +0100
  [PATCH 01/15] tools include: Introduce linux/compiler-gcc.h Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 02:20 +0100
  [PATCH 07/15] tools lib traceevent: Initialize lenght on OLD_RING_BUFFER_TYPE_TIME_STAMP Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 02:20 +0100
  [PATCH 09/15] perf evsel: Inform how to make a sysctl setting permanent Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-14 02:20 +0100
  Re: [GIT PULL 00/15] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2017-02-14 07:40 +0100

csiph-web