Skip to content

Commit

Permalink
perf callchain: Append callchains only when requested
Browse files Browse the repository at this point in the history
The perf report --children can be called with callchain disabled so no
need to append callchains.  Actually the root of callchain tree is not
initialized properly in this case.

Signed-off-by: Namhyung Kim <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
namhyung authored and acmel committed Dec 23, 2014
1 parent b11bc8e commit 82aa019
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/perf/util/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template,
size_t callchain_size = 0;
struct hist_entry *he;

if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain)
if (symbol_conf.use_callchain)
callchain_size = sizeof(struct callchain_root);

he = zalloc(sizeof(*he) + callchain_size);
Expand Down Expand Up @@ -737,7 +737,7 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter,
iter->he = he;
he_cache[iter->curr++] = he;

callchain_append(he->callchain, &callchain_cursor, sample->period);
hist_entry__append_callchain(he, sample);

/*
* We need to re-initialize the cursor since callchain_append()
Expand Down Expand Up @@ -810,7 +810,8 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter,
iter->he = he;
he_cache[iter->curr++] = he;

callchain_append(he->callchain, &cursor, sample->period);
if (symbol_conf.use_callchain)
callchain_append(he->callchain, &cursor, sample->period);
return 0;
}

Expand Down

0 comments on commit 82aa019

Please sign in to comment.