diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/callchain.h | 6 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 3 | ||||
-rw-r--r-- | tools/perf/util/session.c | 7 |
3 files changed, 14 insertions, 2 deletions
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index 1a79df9f739f..9b4ff16cac96 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
@@ -14,6 +14,11 @@ enum chain_mode { | |||
14 | CHAIN_GRAPH_REL | 14 | CHAIN_GRAPH_REL |
15 | }; | 15 | }; |
16 | 16 | ||
17 | enum chain_order { | ||
18 | ORDER_CALLER, | ||
19 | ORDER_CALLEE | ||
20 | }; | ||
21 | |||
17 | struct callchain_node { | 22 | struct callchain_node { |
18 | struct callchain_node *parent; | 23 | struct callchain_node *parent; |
19 | struct list_head siblings; | 24 | struct list_head siblings; |
@@ -41,6 +46,7 @@ struct callchain_param { | |||
41 | u32 print_limit; | 46 | u32 print_limit; |
42 | double min_percent; | 47 | double min_percent; |
43 | sort_chain_func_t sort; | 48 | sort_chain_func_t sort; |
49 | enum chain_order order; | ||
44 | }; | 50 | }; |
45 | 51 | ||
46 | struct callchain_list { | 52 | struct callchain_list { |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 627a02e03c57..dae4202fa65a 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -14,7 +14,8 @@ enum hist_filter { | |||
14 | 14 | ||
15 | struct callchain_param callchain_param = { | 15 | struct callchain_param callchain_param = { |
16 | .mode = CHAIN_GRAPH_REL, | 16 | .mode = CHAIN_GRAPH_REL, |
17 | .min_percent = 0.5 | 17 | .min_percent = 0.5, |
18 | .order = ORDER_CALLEE | ||
18 | }; | 19 | }; |
19 | 20 | ||
20 | u16 hists__col_len(struct hists *self, enum hist_column col) | 21 | u16 hists__col_len(struct hists *self, enum hist_column col) |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index b723f211881c..558bcf996949 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -247,9 +247,14 @@ int perf_session__resolve_callchain(struct perf_session *self, | |||
247 | callchain_cursor_reset(&self->callchain_cursor); | 247 | callchain_cursor_reset(&self->callchain_cursor); |
248 | 248 | ||
249 | for (i = 0; i < chain->nr; i++) { | 249 | for (i = 0; i < chain->nr; i++) { |
250 | u64 ip = chain->ips[i]; | 250 | u64 ip; |
251 | struct addr_location al; | 251 | struct addr_location al; |
252 | 252 | ||
253 | if (callchain_param.order == ORDER_CALLEE) | ||
254 | ip = chain->ips[i]; | ||
255 | else | ||
256 | ip = chain->ips[chain->nr - i - 1]; | ||
257 | |||
253 | if (ip >= PERF_CONTEXT_MAX) { | 258 | if (ip >= PERF_CONTEXT_MAX) { |
254 | switch (ip) { | 259 | switch (ip) { |
255 | case PERF_CONTEXT_HV: | 260 | case PERF_CONTEXT_HV: |