perf annotate: Move max_jump_sources to struct annotation

This is not useful only for the TUI, we'll want to somehow mark the
--stdio2 lines with the most jump sources too.

And moving this will allow us to change some function signatures from
annotate_browser to ui_browser, reducing boilerplate.

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-vyggbbqd05k3k4mvv7z9l5px@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 95aa89d9
...@@ -44,7 +44,6 @@ struct annotate_browser { ...@@ -44,7 +44,6 @@ struct annotate_browser {
u64 start; u64 start;
int nr_asm_entries; int nr_asm_entries;
int nr_entries; int nr_entries;
int max_jump_sources;
int nr_jumps; int nr_jumps;
bool searching_backwards; bool searching_backwards;
u8 addr_width; u8 addr_width;
...@@ -85,9 +84,11 @@ static bool disasm_line__filter(struct ui_browser *browser, void *entry) ...@@ -85,9 +84,11 @@ static bool disasm_line__filter(struct ui_browser *browser, void *entry)
static int annotate_browser__jumps_percent_color(struct annotate_browser *browser, static int annotate_browser__jumps_percent_color(struct annotate_browser *browser,
int nr, bool current) int nr, bool current)
{ {
struct annotation *notes = browser__annotation(&browser->b);
if (current && (!browser->b.use_navkeypressed || browser->b.navkeypressed)) if (current && (!browser->b.use_navkeypressed || browser->b.navkeypressed))
return HE_COLORSET_SELECTED; return HE_COLORSET_SELECTED;
if (nr == browser->max_jump_sources) if (nr == notes->max_jump_sources)
return HE_COLORSET_TOP; return HE_COLORSET_TOP;
if (nr > 1) if (nr > 1)
return HE_COLORSET_MEDIUM; return HE_COLORSET_MEDIUM;
...@@ -998,8 +999,8 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser ...@@ -998,8 +999,8 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser
continue; continue;
blt = browser_line(al); blt = browser_line(al);
if (++blt->jump_sources > browser->max_jump_sources) if (++blt->jump_sources > notes->max_jump_sources)
browser->max_jump_sources = blt->jump_sources; notes->max_jump_sources = blt->jump_sources;
++browser->nr_jumps; ++browser->nr_jumps;
} }
...@@ -1099,7 +1100,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, ...@@ -1099,7 +1100,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
browser.addr_width = browser.target_width = browser.min_addr_width = hex_width(size); browser.addr_width = browser.target_width = browser.min_addr_width = hex_width(size);
browser.max_addr_width = hex_width(sym->end); browser.max_addr_width = hex_width(sym->end);
browser.jumps_width = width_jumps(browser.max_jump_sources); browser.jumps_width = width_jumps(notes->max_jump_sources);
notes->nr_events = nr_pcnt; notes->nr_events = nr_pcnt;
browser.b.nr_entries = browser.nr_entries; browser.b.nr_entries = browser.nr_entries;
browser.b.entries = &notes->src->source, browser.b.entries = &notes->src->source,
......
...@@ -167,6 +167,7 @@ struct annotation { ...@@ -167,6 +167,7 @@ struct annotation {
struct annotation_options *options; struct annotation_options *options;
struct annotation_line **offsets; struct annotation_line **offsets;
int nr_events; int nr_events;
int max_jump_sources;
bool have_cycles; bool have_cycles;
struct annotated_source *src; struct annotated_source *src;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment