]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
perf annotate: Introduce init_column_widths() method out of TUI code
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 15 Mar 2018 19:26:29 +0000 (16:26 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 20 Mar 2018 16:19:29 +0000 (13:19 -0300)
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>
tools/perf/ui/browsers/annotate.c
tools/perf/util/annotate.c
tools/perf/util/annotate.h

index ab4d004fc184a1bdad3559731f6684a3dae4783b..06ad5ecaa67a8b5c60f29400304667b37d9e3398 100644 (file)
@@ -905,15 +905,6 @@ int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
        return map_symbol__tui_annotate(&he->ms, evsel, hbt);
 }
 
-static inline int width_jumps(int n)
-{
-       if (n >= 100)
-               return 5;
-       if (n / 10)
-               return 2;
-       return 1;
-}
-
 int symbol__tui_annotate(struct symbol *sym, struct map *map,
                         struct perf_evsel *evsel,
                         struct hist_browser_timer *hbt)
@@ -974,10 +965,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
        browser.b.width = notes->max_line_len;
        annotation__mark_jump_targets(notes, sym);
        annotation__compute_ipc(notes, size);
-
-       notes->widths.addr = notes->widths.target = notes->widths.min_addr = hex_width(size);
-       notes->widths.max_addr = hex_width(sym->end);
-       notes->widths.jumps = width_jumps(notes->max_jump_sources);
+       annotation__init_column_widths(notes, sym);
        notes->nr_events = nr_pcnt;
        browser.b.nr_entries = notes->nr_entries;
        browser.b.entries = &notes->src->source,
index 8a2fda80a22141e4be47e787ecd841cadfad3109..9c05b534f428cf6115a0b86405d97d3398e5f24b 100644 (file)
@@ -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)
index a8bea758490aa5de444480b03761d50f17777d45..c4528e03a031b20db3b080039a8cecc66a4736a1 100644 (file)
@@ -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)
 {