aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/callchain.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-01-14 00:25:35 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-01-15 13:32:43 -0500
commit2dc9fb1a7bf013ce24dd34bc25283b60b966f015 (patch)
tree5350a5b6d4fc4c469a68335c679c7d7cb35b33bf /tools/perf/util/callchain.c
parent540476de74c9b11403656791838ede91405d3859 (diff)
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>
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r--tools/perf/util/callchain.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index e3970e3eaacf..9eb4f57f8663 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -17,6 +17,8 @@
17 17
18#include "hist.h" 18#include "hist.h"
19#include "util.h" 19#include "util.h"
20#include "sort.h"
21#include "machine.h"
20#include "callchain.h" 22#include "callchain.h"
21 23
22__thread struct callchain_cursor callchain_cursor; 24__thread struct callchain_cursor callchain_cursor;
@@ -531,3 +533,24 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
531 533
532 return 0; 534 return 0;
533} 535}
536
537int sample__resolve_callchain(struct perf_sample *sample, struct symbol **parent,
538 struct perf_evsel *evsel, struct addr_location *al,
539 int max_stack)
540{
541 if (sample->callchain == NULL)
542 return 0;
543
544 if (symbol_conf.use_callchain || sort__has_parent) {
545 return machine__resolve_callchain(al->machine, evsel, al->thread,
546 sample, parent, al, max_stack);
547 }
548 return 0;
549}
550
551int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample)
552{
553 if (!symbol_conf.use_callchain)
554 return 0;
555 return callchain_append(he->callchain, &callchain_cursor, sample->period);
556}