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


Groups > linux.kernel > #1253855

Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order only if --children is enabled

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order only if --children is enabled
Date 2015-10-22 16:20 +0200
Message-ID <qmoSL-4U2-21@gated-at.bofh.it> (permalink)
References <qmhxU-2nM-7@gated-at.bofh.it> <qmhxU-2nM-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Thu, Oct 22, 2015 at 03:28:50PM +0900, Namhyung Kim escreveu:
> +++ b/tools/perf/util/util.c
> @@ -19,7 +19,7 @@
>  struct callchain_param	callchain_param = {
>  	.mode	= CHAIN_GRAPH_ABS,
>  	.min_percent = 0.5,
> -	.order  = ORDER_CALLER,
> +	.order  = ORDER_CALLEE,
>  	.key	= CCKEY_FUNCTION
>  };

So, this isn't a revert of the previous default change, i.e. previously
we used CHAIN_GRAPH_REL, should we keep CHAIN_GRAPH_ABS + callee?

Also you forgot to fix the docs to mention this new default, I did it
and the resulting patch, still with GRAPH_ABS follows:

From fd2dcde26d09b34fccc3c164d9fc36e662c21fc4 Mon Sep 17 00:00:00 2001
From: Namhyung Kim <namhyung@kernel.org>
Date: Thu, 22 Oct 2015 16:45:46 +0900
Subject: [PATCH 1/1] perf tools: Defaults to 'caller' callchain order only if
 --children is enabled

The caller callchain order is useful with --children option since it can
show 'overview' style output, but other commands which don't use
--children feature like 'perf script' or even 'perf report/top' without
--children are better to keep callee order.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Chandler Carruth <chandlerc@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1445499946-29817-1-git-send-email-namhyung@kernel.org
[ Update 'perf report' man page ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-report.txt | 2 +-
 tools/perf/builtin-report.c              | 2 ++
 tools/perf/builtin-top.c                 | 3 +++
 tools/perf/util/callchain.c              | 2 ++
 tools/perf/util/callchain.h              | 1 +
 tools/perf/util/util.c                   | 2 +-
 6 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index e4fdeeb51123..4ae1621f1def 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -192,7 +192,7 @@ OPTIONS
 	when available. Usually more convenient to use --branch-history
 	for this.
 
-	Default: graph,0.5,caller
+	Default: graph,0.5,callee
 
 --children::
 	Accumulate callchain of children to parent entry so that then can
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 3b23b25d1589..a554906a3e03 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -808,6 +808,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	if (report.inverted_callchain)
 		callchain_param.order = ORDER_CALLER;
+	if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
+		callchain_param.order = ORDER_CALLER;
 
 	if (itrace_synth_opts.callchain &&
 	    (int)itrace_synth_opts.callchain_sz > report.max_stack)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6f641fd68296..be42e6eb6805 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1288,6 +1288,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
 		perf_hpp__cancel_cumulate();
 	}
 
+	if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
+		callchain_param.order = ORDER_CALLER;
+
 	symbol_conf.priv_size = sizeof(struct annotation);
 
 	symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 773fe13ce627..a8ed80f77ff3 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -51,10 +51,12 @@ static int parse_callchain_order(const char *value)
 {
 	if (!strncmp(value, "caller", strlen(value))) {
 		callchain_param.order = ORDER_CALLER;
+		callchain_param.order_set = true;
 		return 0;
 	}
 	if (!strncmp(value, "callee", strlen(value))) {
 		callchain_param.order = ORDER_CALLEE;
+		callchain_param.order_set = true;
 		return 0;
 	}
 	return -1;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index acee2b3cd801..0e96496567c5 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -63,6 +63,7 @@ struct callchain_param {
 	double			min_percent;
 	sort_chain_func_t	sort;
 	enum chain_order	order;
+	bool			order_set;
 	enum chain_key		key;
 	bool			branch_callstack;
 };
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index c1bf9ff210b0..cd12c25e4ea4 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -19,7 +19,7 @@
 struct callchain_param	callchain_param = {
 	.mode	= CHAIN_GRAPH_ABS,
 	.min_percent = 0.5,
-	.order  = ORDER_CALLER,
+	.order  = ORDER_CALLEE,
 	.key	= CCKEY_FUNCTION
 };
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order only if --children is enabled Namhyung Kim <namhyung@kernel.org> - 2015-10-22 08:30 +0200
  Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Ingo Molnar <mingo@kernel.org> - 2015-10-22 09:40 +0200
    Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Namhyung Kim <namhyung@kernel.org> - 2015-10-22 09:40 +0200
      Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Brendan Gregg <brendan.d.gregg@gmail.com> - 2015-10-22 11:50 +0200
        Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-22 16:10 +0200
      Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-22 14:30 +0200
  [RFC/PATCH RESEND 3/3] perf tools: Defaults to 'caller' callchain order only if --children is enabled Namhyung Kim <namhyung@kernel.org> - 2015-10-22 09:50 +0200
    Re: [RFC/PATCH RESEND 3/3] perf tools: Defaults to 'caller'  callchain order only if --children is enabled Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-22 20:40 +0200
    [tip:perf/core] perf tools: Defaults to 'caller'   callchain order only if --children is enabled tip-bot for Namhyung Kim <tipbot@zytor.com> - 2015-10-23 10:40 +0200
  Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-22 14:20 +0200
  Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-22 16:20 +0200
    Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Namhyung Kim <namhyung@kernel.org> - 2015-10-22 16:30 +0200
      Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-22 16:40 +0200
        Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Namhyung Kim <namhyung@kernel.org> - 2015-10-22 18:00 +0200
          Re: [RFC/PATCH 3/3] perf tools: Defaults to 'caller' callchain order  only if --children is enabled Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-22 18:30 +0200

csiph-web