perf tools: Factor out sample__resolve_callchain()

The report__resolve_callchain() can be shared with perf top code as it
doesn't really depend on the perf report code.  Factor it out as
sample__resolve_callchain().  The same goes to the hist_entry__append_
callchain() too.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Arun Sharma <asharma@fb.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Rodrigo Campos <rodrigo@sdfg.com.ar>
Link: http://lkml.kernel.org/r/1389677157-30513-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Namhyung Kim
2014-01-14 14:25:35 +09:00
committed by Arnaldo Carvalho de Melo
parent 540476de74
commit 2dc9fb1a7b
4 changed files with 39 additions and 36 deletions

View File

@@ -743,15 +743,10 @@ static void perf_event__process_sample(struct perf_tool *tool,
if (al.sym == NULL || !al.sym->ignore) {
struct hist_entry *he;
if ((sort__has_parent || symbol_conf.use_callchain) &&
sample->callchain) {
err = machine__resolve_callchain(machine, evsel,
al.thread, sample,
&parent, &al,
top->max_stack);
if (err)
return;
}
err = sample__resolve_callchain(sample, &parent, evsel, &al,
top->max_stack);
if (err)
return;
he = perf_evsel__add_hist_entry(evsel, &al, sample);
if (he == NULL) {
@@ -759,12 +754,9 @@ static void perf_event__process_sample(struct perf_tool *tool,
return;
}
if (symbol_conf.use_callchain) {
err = callchain_append(he->callchain, &callchain_cursor,
sample->period);
if (err)
return;
}
err = hist_entry__append_callchain(he, sample);
if (err)
return;
if (sort__has_sym)
perf_top__record_precise_ip(top, he, evsel->idx, ip);