diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-01-14 00:25:35 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-15 13:32:43 -0500 |
commit | 2dc9fb1a7bf013ce24dd34bc25283b60b966f015 (patch) | |
tree | 5350a5b6d4fc4c469a68335c679c7d7cb35b33bf /tools/perf/builtin-report.c | |
parent | 540476de74c9b11403656791838ede91405d3859 (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/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 46864dd7eb83..3c53ec268fbc 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -75,24 +75,6 @@ static int report__config(const char *var, const char *value, void *cb) | |||
75 | return perf_default_config(var, value, cb); | 75 | return perf_default_config(var, value, cb); |
76 | } | 76 | } |
77 | 77 | ||
78 | static int report__resolve_callchain(struct report *rep, struct symbol **parent, | ||
79 | struct perf_evsel *evsel, struct addr_location *al, | ||
80 | struct perf_sample *sample) | ||
81 | { | ||
82 | if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) { | ||
83 | return machine__resolve_callchain(al->machine, evsel, al->thread, sample, | ||
84 | parent, al, rep->max_stack); | ||
85 | } | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static int hist_entry__append_callchain(struct hist_entry *he, struct perf_sample *sample) | ||
90 | { | ||
91 | if (!symbol_conf.use_callchain) | ||
92 | return 0; | ||
93 | return callchain_append(he->callchain, &callchain_cursor, sample->period); | ||
94 | } | ||
95 | |||
96 | static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_location *al, | 78 | static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_location *al, |
97 | struct perf_sample *sample, struct perf_evsel *evsel, | 79 | struct perf_sample *sample, struct perf_evsel *evsel, |
98 | union perf_event *event) | 80 | union perf_event *event) |
@@ -103,7 +85,7 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati | |||
103 | struct hist_entry *he; | 85 | struct hist_entry *he; |
104 | struct mem_info *mi, *mx; | 86 | struct mem_info *mi, *mx; |
105 | uint64_t cost; | 87 | uint64_t cost; |
106 | int err = report__resolve_callchain(rep, &parent, evsel, al, sample); | 88 | int err = sample__resolve_callchain(sample, &parent, evsel, al, rep->max_stack); |
107 | 89 | ||
108 | if (err) | 90 | if (err) |
109 | return err; | 91 | return err; |
@@ -155,7 +137,7 @@ static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_loc | |||
155 | unsigned i; | 137 | unsigned i; |
156 | struct hist_entry *he; | 138 | struct hist_entry *he; |
157 | struct branch_info *bi, *bx; | 139 | struct branch_info *bi, *bx; |
158 | int err = report__resolve_callchain(rep, &parent, evsel, al, sample); | 140 | int err = sample__resolve_callchain(sample, &parent, evsel, al, rep->max_stack); |
159 | 141 | ||
160 | if (err) | 142 | if (err) |
161 | return err; | 143 | return err; |
@@ -208,7 +190,7 @@ static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evs | |||
208 | struct report *rep = container_of(tool, struct report, tool); | 190 | struct report *rep = container_of(tool, struct report, tool); |
209 | struct symbol *parent = NULL; | 191 | struct symbol *parent = NULL; |
210 | struct hist_entry *he; | 192 | struct hist_entry *he; |
211 | int err = report__resolve_callchain(rep, &parent, evsel, al, sample); | 193 | int err = sample__resolve_callchain(sample, &parent, evsel, al, rep->max_stack); |
212 | 194 | ||
213 | if (err) | 195 | if (err) |
214 | return err; | 196 | return err; |