Commit 82aa019e authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf callchain: Append callchains only when requested

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: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1419223455-4362-7-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b11bc8e2
...@@ -304,7 +304,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template, ...@@ -304,7 +304,7 @@ static struct hist_entry *hist_entry__new(struct hist_entry *template,
size_t callchain_size = 0; size_t callchain_size = 0;
struct hist_entry *he; struct hist_entry *he;
if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) if (symbol_conf.use_callchain)
callchain_size = sizeof(struct callchain_root); callchain_size = sizeof(struct callchain_root);
he = zalloc(sizeof(*he) + callchain_size); he = zalloc(sizeof(*he) + callchain_size);
...@@ -737,7 +737,7 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter, ...@@ -737,7 +737,7 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter,
iter->he = he; iter->he = he;
he_cache[iter->curr++] = 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() * We need to re-initialize the cursor since callchain_append()
...@@ -810,6 +810,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter, ...@@ -810,6 +810,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter,
iter->he = he; iter->he = he;
he_cache[iter->curr++] = he; he_cache[iter->curr++] = he;
if (symbol_conf.use_callchain)
callchain_append(he->callchain, &cursor, sample->period); callchain_append(he->callchain, &cursor, sample->period);
return 0; return 0;
} }
......
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