perf tools: Defaults to 'caller' callchain order only if --children is enabled
authorNamhyung Kim <[email protected]>
Thu, 22 Oct 2015 07:45:46 +0000 (16:45 +0900)
committerArnaldo Carvalho de Melo <[email protected]>
Thu, 22 Oct 2015 18:40:11 +0000 (15:40 -0300)
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 <[email protected]>
Acked-by: Brendan Gregg <[email protected]>
Acked-by: Frederic Weisbecker <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Chandler Carruth <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-report.c
tools/perf/builtin-top.c
tools/perf/util/callchain.c
tools/perf/util/callchain.h
tools/perf/util/util.c

index 18a8c52d921eb931b76dc9b297871270708581e8..545c51cef7f7b27c609441f6409b2b244376ab55 100644 (file)
@@ -812,6 +812,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)
index 1de381d3f29f2ba6392d5641a9be3c76eff0998a..af849b1d7389af0d8a02dd9e20e48456c4023fed 100644 (file)
@@ -1304,6 +1304,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);
index 842be32899ee1b1b6b22076b6dec7fcf3883f2ef..735ad48e1858b0382c9aacc84e0b912e9329c86a 100644 (file)
@@ -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;
index 836d59a001bc45309ce530970f8f0b8e2d9072ba..aaf467c9ef2b24139dbb1b1ce955c07034a3ebf1 100644 (file)
@@ -75,6 +75,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;
 };
index c1bf9ff210b0e878542f416eb2902af94d0a7dcc..cd12c25e4ea408b1b873d8368f5081d3e2a72113 100644 (file)
@@ -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
 };