aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/stdio/hist.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-01-27 10:40:52 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-02-01 15:39:52 -0500
commit54d27b3119e2eecbb3dfbf821db90fab25f6c523 (patch)
treed2d74d89593f37f52b1dc6758e1f8bbf1fe8163b /tools/perf/ui/stdio/hist.c
parent7e597d327eca3d92a759542ff707cba61af3a718 (diff)
perf callchain: Pass parent_samples to __callchain__fprintf_graph()
Pass hist entry's period to graph callchain print function. This info is needed by later patch to determine whether it can omit percentage of top-level node or not. No functional change intended. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1453909257-26015-6-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/stdio/hist.c')
-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);