diff options
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 9c05b534f428..7ad6400a0d4f 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -2183,3 +2183,42 @@ bool ui__has_annotation(void) | |||
2183 | { | 2183 | { |
2184 | return use_browser == 1 && perf_hpp_list.sym; | 2184 | return use_browser == 1 && perf_hpp_list.sym; |
2185 | } | 2185 | } |
2186 | |||
2187 | int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *evsel, | ||
2188 | struct annotation_options *options, struct arch **parch) | ||
2189 | { | ||
2190 | struct annotation *notes = symbol__annotation(sym); | ||
2191 | size_t size = symbol__size(sym); | ||
2192 | int nr_pcnt = 1, err; | ||
2193 | |||
2194 | notes->offsets = zalloc(size * sizeof(struct annotation_line *)); | ||
2195 | if (notes->offsets == NULL) | ||
2196 | return -1; | ||
2197 | |||
2198 | if (perf_evsel__is_group_event(evsel)) | ||
2199 | nr_pcnt = evsel->nr_members; | ||
2200 | |||
2201 | err = symbol__annotate(sym, map, evsel, 0, parch); | ||
2202 | if (err) | ||
2203 | goto out_free_offsets; | ||
2204 | |||
2205 | notes->options = options; | ||
2206 | |||
2207 | symbol__calc_percent(sym, evsel); | ||
2208 | |||
2209 | notes->start = map__rip_2objdump(map, sym->start); | ||
2210 | |||
2211 | annotation__set_offsets(notes, size); | ||
2212 | annotation__mark_jump_targets(notes, sym); | ||
2213 | annotation__compute_ipc(notes, size); | ||
2214 | annotation__init_column_widths(notes, sym); | ||
2215 | notes->nr_events = nr_pcnt; | ||
2216 | |||
2217 | annotation__update_column_widths(notes); | ||
2218 | |||
2219 | return 0; | ||
2220 | |||
2221 | out_free_offsets: | ||
2222 | zfree(¬es->offsets); | ||
2223 | return -1; | ||
2224 | } | ||