perf annotate: Introduce init_column_widths() method out of TUI code
More non-TUI stuff goes to the UI-agnostic library Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-hngv7rpqvtta69ouj7ne770q@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user