summaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2017-02-10 02:36:13 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-02-13 12:29:37 -0500
commit4b35994abe459f08f58b4b3855abf4ba80308680 (patch)
treedae5371d583a12e6ebbcfb56ee27d705d5d8920e /tools/perf
parentd49dd15d69731589de4436a6dcfca59567320fdf (diff)
perf diff: Add diff.compute config option
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>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Documentation/perf-config.txt5
-rw-r--r--tools/perf/Documentation/perf-diff.txt5
-rw-r--r--tools/perf/builtin-diff.c16
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.*::
505 Setting it to 1 will sort the result by delta (or other 505 Setting it to 1 will sort the result by delta (or other
506 compute method selected). 506 compute method selected).
507 507
508 diff.compute::
509 This options sets the method for computing the diff result.
510 Possible values are 'delta', 'delta-abs', 'ratio' and
511 'wdiff'. Default is 'delta'.
512
508SEE ALSO 513SEE ALSO
509-------- 514--------
510linkperf:perf[1] 515linkperf: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
86 86
87-c:: 87-c::
88--compute:: 88--compute::
89 Differential computation selection - delta,ratio,wdiff,delta-abs (default is delta). 89 Differential computation selection - delta, ratio, wdiff, delta-abs
90 See COMPARISON METHODS section for more info. 90 (default is delta). Default can be changed using diff.compute
91 config option. See COMPARISON METHODS section for more info.
91 92
92-p:: 93-p::
93--period:: 94--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] = {
86 [COMPUTE_WEIGHTED_DIFF] = "wdiff", 86 [COMPUTE_WEIGHTED_DIFF] = "wdiff",
87}; 87};
88 88
89static int compute; 89static int compute = COMPUTE_DELTA;
90 90
91static int compute_2_hpp[COMPUTE_MAX] = { 91static int compute_2_hpp[COMPUTE_MAX] = {
92 [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA, 92 [COMPUTE_DELTA] = PERF_HPP_DIFF__DELTA,
@@ -1299,6 +1299,20 @@ static int diff__config(const char *var, const char *value,
1299 sort_compute = perf_config_int(var, value); 1299 sort_compute = perf_config_int(var, value);
1300 return 0; 1300 return 0;
1301 } 1301 }
1302 if (!strcmp(var, "diff.compute")) {
1303 if (!strcmp(value, "delta")) {
1304 compute = COMPUTE_DELTA;
1305 } else if (!strcmp(value, "delta-abs")) {
1306 compute = COMPUTE_DELTA_ABS;
1307 } else if (!strcmp(value, "ratio")) {
1308 compute = COMPUTE_RATIO;
1309 } else if (!strcmp(value, "wdiff")) {
1310 compute = COMPUTE_WEIGHTED_DIFF;
1311 } else {
1312 pr_err("Invalid compute method: %s\n", value);
1313 return -1;
1314 }
1315 }
1302 1316
1303 return 0; 1317 return 0;
1304} 1318}