]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
perf diff: Add diff.compute config option
authorNamhyung Kim <namhyung@kernel.org>
Fri, 10 Feb 2017 07:36:13 +0000 (16:36 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Feb 2017 17:29:37 +0000 (14:29 -0300)
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
tools/perf/Documentation/perf-diff.txt
tools/perf/builtin-diff.c

index 49ab79d662fa3ac8dcabd9a3fb7c5709f3ae74b2..5b4fff3adc4be4ca66a30a9e8b85b55e1a472f4a 100644 (file)
@@ -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]
index 7c014c9934bb1500bf2b2f05277db38f10f7faf7..7391299defefcf3aa5880d21f5834e77968eac8c 100644 (file)
@@ -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::
index 181ff996e0391b317aef5a7cbc85e04573b68092..e68cc76bdc5afab8227f7f3824a14aebf649bdda 100644 (file)
@@ -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;
 }