diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/annotate.c | 17 | ||||
-rw-r--r-- | tools/perf/util/annotate.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 8a2fda8..9c05b53 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -2084,6 +2084,23 @@ void annotation__set_offsets(struct annotation *notes, s64 size) } } +static inline int width_jumps(int n) +{ + if (n >= 100) + return 5; + if (n / 10) + return 2; + return 1; +} + +void annotation__init_column_widths(struct annotation *notes, struct symbol *sym) +{ + notes->widths.addr = notes->widths.target = + notes->widths.min_addr = hex_width(symbol__size(sym)); + notes->widths.max_addr = hex_width(sym->end); + notes->widths.jumps = width_jumps(notes->max_jump_sources); +} + void annotation__update_column_widths(struct annotation *notes) { if (notes->options->use_offset) diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index a8bea75..c4528e0 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -204,6 +204,7 @@ 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); void annotation__update_column_widths(struct annotation *notes); +void annotation__init_column_widths(struct annotation *notes, struct symbol *sym); static inline struct sym_hist *annotation__histogram(struct annotation *notes, int idx) { |