Commit 792aeafa authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

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: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarBrendan Gregg <brendan.d.gregg@gmail.com>
Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a2c10d39
...@@ -812,6 +812,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -812,6 +812,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
if (report.inverted_callchain) if (report.inverted_callchain)
callchain_param.order = ORDER_CALLER; callchain_param.order = ORDER_CALLER;
if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
callchain_param.order = ORDER_CALLER;
if (itrace_synth_opts.callchain && if (itrace_synth_opts.callchain &&
(int)itrace_synth_opts.callchain_sz > report.max_stack) (int)itrace_synth_opts.callchain_sz > report.max_stack)
......
...@@ -1304,6 +1304,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) ...@@ -1304,6 +1304,9 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
perf_hpp__cancel_cumulate(); 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.priv_size = sizeof(struct annotation);
symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL); symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
......
...@@ -51,10 +51,12 @@ static int parse_callchain_order(const char *value) ...@@ -51,10 +51,12 @@ static int parse_callchain_order(const char *value)
{ {
if (!strncmp(value, "caller", strlen(value))) { if (!strncmp(value, "caller", strlen(value))) {
callchain_param.order = ORDER_CALLER; callchain_param.order = ORDER_CALLER;
callchain_param.order_set = true;
return 0; return 0;
} }
if (!strncmp(value, "callee", strlen(value))) { if (!strncmp(value, "callee", strlen(value))) {
callchain_param.order = ORDER_CALLEE; callchain_param.order = ORDER_CALLEE;
callchain_param.order_set = true;
return 0; return 0;
} }
return -1; return -1;
......
...@@ -75,6 +75,7 @@ struct callchain_param { ...@@ -75,6 +75,7 @@ struct callchain_param {
double min_percent; double min_percent;
sort_chain_func_t sort; sort_chain_func_t sort;
enum chain_order order; enum chain_order order;
bool order_set;
enum chain_key key; enum chain_key key;
bool branch_callstack; bool branch_callstack;
}; };
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
struct callchain_param callchain_param = { struct callchain_param callchain_param = {
.mode = CHAIN_GRAPH_ABS, .mode = CHAIN_GRAPH_ABS,
.min_percent = 0.5, .min_percent = 0.5,
.order = ORDER_CALLER, .order = ORDER_CALLEE,
.key = CCKEY_FUNCTION .key = CCKEY_FUNCTION
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment