aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/ui/stdio/hist.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 8e25f7dd6e84..96188ea12771 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -166,7 +166,8 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
166} 166}
167 167
168static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root, 168static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
169 u64 total_samples, int left_margin) 169 u64 total_samples, u64 parent_samples,
170 int left_margin)
170{ 171{
171 struct callchain_node *cnode; 172 struct callchain_node *cnode;
172 struct callchain_list *chain; 173 struct callchain_list *chain;
@@ -213,6 +214,9 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
213 root = &cnode->rb_root; 214 root = &cnode->rb_root;
214 } 215 }
215 216
217 if (callchain_param.mode == CHAIN_GRAPH_REL)
218 total_samples = parent_samples;
219
216 ret += __callchain__fprintf_graph(fp, root, total_samples, 220 ret += __callchain__fprintf_graph(fp, root, total_samples,
217 1, 1, left_margin); 221 1, 1, left_margin);
218 ret += fprintf(fp, "\n"); 222 ret += fprintf(fp, "\n");
@@ -323,16 +327,19 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
323 u64 total_samples, int left_margin, 327 u64 total_samples, int left_margin,
324 FILE *fp) 328 FILE *fp)
325{ 329{
330 u64 parent_samples = he->stat.period;
331
332 if (symbol_conf.cumulate_callchain)
333 parent_samples = he->stat_acc->period;
334
326 switch (callchain_param.mode) { 335 switch (callchain_param.mode) {
327 case CHAIN_GRAPH_REL: 336 case CHAIN_GRAPH_REL:
328 return callchain__fprintf_graph(fp, &he->sorted_chain, 337 return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
329 symbol_conf.cumulate_callchain ? 338 parent_samples, left_margin);
330 he->stat_acc->period : he->stat.period,
331 left_margin);
332 break; 339 break;
333 case CHAIN_GRAPH_ABS: 340 case CHAIN_GRAPH_ABS:
334 return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples, 341 return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
335 left_margin); 342 parent_samples, left_margin);
336 break; 343 break;
337 case CHAIN_FLAT: 344 case CHAIN_FLAT:
338 return callchain__fprintf_flat(fp, &he->sorted_chain, total_samples); 345 return callchain__fprintf_flat(fp, &he->sorted_chain, total_samples);