diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/annotate.c | 28 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 3 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 330275680a1a..b976e3951662 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -2056,6 +2056,34 @@ void annotation__mark_jump_targets(struct annotation *notes, struct symbol *sym) } } +void annotation__set_offsets(struct annotation *notes, s64 size) +{ + struct annotation_line *al; + + notes->max_line_len = 0; + + list_for_each_entry(al, ¬es->src->source, node) { + size_t line_len = strlen(al->line); + + if (notes->max_line_len < line_len) + notes->max_line_len = line_len; + al->idx = notes->nr_entries++; + if (al->offset != -1) { + al->idx_asm = notes->nr_asm_entries++; + /* + * FIXME: short term bandaid to cope with assembly + * routines that comes with labels in the same column + * as the address in objdump, sigh. + * + * E.g. copy_user_generic_unrolled + */ + if (al->offset < size) + notes->offsets[al->offset] = al; + } else + al->idx_asm = -1; + } +} + static void annotation__calc_lines(struct annotation *notes, struct map *map, struct rb_root *root, u64 start) { diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 0c34eb0bd7c8..8a61ec9a5291 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -177,6 +177,7 @@ struct annotation { int max_jump_sources; int nr_entries; int nr_asm_entries; + u16 max_line_len; bool have_cycles; struct annotated_source *src; }; @@ -191,6 +192,8 @@ static inline int annotation__pcnt_width(struct annotation *notes) return (notes->options->show_total_period ? 12 : 7) * notes->nr_events; } + +void annotation__set_offsets(struct annotation *notes, s64 size); void annotation__compute_ipc(struct annotation *notes, size_t size); void annotation__mark_jump_targets(struct annotation *notes, struct symbol *sym); |