public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@kernel.org, namhyung@kernel.org, acme@redhat.com,
	a.p.zijlstra@chello.nl, tglx@linutronix.de,
	treeze.taeung@gmail.com, linux-kernel@vger.kernel.org,
	hpa@zytor.com, mingo@kernel.org
Subject: [tip:perf/core] perf diff: Add diff.compute config option
Date: Mon, 13 Feb 2017 22:39:06 -0800	[thread overview]
Message-ID: <tip-4b35994abe459f08f58b4b3855abf4ba80308680@git.kernel.org> (raw)
In-Reply-To: <20170210073614.24584-4-namhyung@kernel.org>

Commit-ID:  4b35994abe459f08f58b4b3855abf4ba80308680
Gitweb:     http://git.kernel.org/tip/4b35994abe459f08f58b4b3855abf4ba80308680
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 10 Feb 2017 16:36:13 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 13 Feb 2017 14:29:37 -0300

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>
---
 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 49ab79d..5b4fff3 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 7c014c9..7391299 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 181ff99..e68cc76 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;
 }

  reply	other threads:[~2017-02-14  6:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10  7:36 [PATCHSET 0/4] perf diff: Introduce delta-abs compute method (v2) Namhyung Kim
2017-02-10  7:36 ` [PATCH v2 1/4] perf diff: Add 'delta-abs' compute method Namhyung Kim
2017-02-14  6:38   ` [tip:perf/core] " tip-bot for Namhyung Kim
2017-02-10  7:36 ` [PATCH v2 2/4] perf diff: Add diff.order config option Namhyung Kim
2017-02-14  6:38   ` [tip:perf/core] " tip-bot for Namhyung Kim
2017-02-10  7:36 ` [PATCH v2 3/4] perf diff: Add diff.compute " Namhyung Kim
2017-02-14  6:39   ` tip-bot for Namhyung Kim [this message]
2017-02-10  7:36 ` [PATCH v2 4/4] perf diff: Change default setting to "delta-abs" Namhyung Kim
2017-02-10 16:18   ` [PATCH v2.1 " Namhyung Kim
2017-02-14  6:39     ` [tip:perf/core] " tip-bot for Namhyung Kim
2017-02-10  7:41 ` [PATCHSET 0/4] perf diff: Introduce delta-abs compute method (v2) Ingo Molnar
2017-02-10  9:14   ` Namhyung Kim
2017-02-10 10:29     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-4b35994abe459f08f58b4b3855abf4ba80308680@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=treeze.taeung@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox