Commit 54d27b31 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

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: default avatarNamhyung 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7e597d32
...@@ -166,7 +166,8 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root, ...@@ -166,7 +166,8 @@ static size_t __callchain__fprintf_graph(FILE *fp, struct rb_root *root,
} }
static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root, static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
u64 total_samples, int left_margin) u64 total_samples, u64 parent_samples,
int left_margin)
{ {
struct callchain_node *cnode; struct callchain_node *cnode;
struct callchain_list *chain; struct callchain_list *chain;
...@@ -213,6 +214,9 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root, ...@@ -213,6 +214,9 @@ static size_t callchain__fprintf_graph(FILE *fp, struct rb_root *root,
root = &cnode->rb_root; root = &cnode->rb_root;
} }
if (callchain_param.mode == CHAIN_GRAPH_REL)
total_samples = parent_samples;
ret += __callchain__fprintf_graph(fp, root, total_samples, ret += __callchain__fprintf_graph(fp, root, total_samples,
1, 1, left_margin); 1, 1, left_margin);
ret += fprintf(fp, "\n"); ret += fprintf(fp, "\n");
...@@ -323,16 +327,19 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he, ...@@ -323,16 +327,19 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
u64 total_samples, int left_margin, u64 total_samples, int left_margin,
FILE *fp) FILE *fp)
{ {
u64 parent_samples = he->stat.period;
if (symbol_conf.cumulate_callchain)
parent_samples = he->stat_acc->period;
switch (callchain_param.mode) { switch (callchain_param.mode) {
case CHAIN_GRAPH_REL: case CHAIN_GRAPH_REL:
return callchain__fprintf_graph(fp, &he->sorted_chain, return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
symbol_conf.cumulate_callchain ? parent_samples, left_margin);
he->stat_acc->period : he->stat.period,
left_margin);
break; break;
case CHAIN_GRAPH_ABS: case CHAIN_GRAPH_ABS:
return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples, return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
left_margin); parent_samples, left_margin);
break; break;
case CHAIN_FLAT: case CHAIN_FLAT:
return callchain__fprintf_flat(fp, &he->sorted_chain, total_samples); return callchain__fprintf_flat(fp, &he->sorted_chain, total_samples);
......
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