perf annotate: Move nr_jumps to struct annotation

This is another information that will be useful for the --stdio2 mode,
to provide symbol statistics, so move it from the TUI and change the
mark_jump_targets() method to struct annotation.

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-kpgle1qxe7thajvrqleuvi80@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 27feb761
...@@ -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 nr_jumps;
bool searching_backwards; bool searching_backwards;
u8 addr_width; u8 addr_width;
u8 jumps_width; u8 jumps_width;
...@@ -965,13 +964,9 @@ int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel, ...@@ -965,13 +964,9 @@ int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
return map_symbol__tui_annotate(&he->ms, evsel, hbt); return map_symbol__tui_annotate(&he->ms, evsel, hbt);
} }
static void annotate_browser__mark_jump_targets(struct annotate_browser *browser, static void annotation__mark_jump_targets(struct annotation *notes, struct symbol *sym)
size_t size)
{ {
u64 offset; u64 offset, size = symbol__size(sym);
struct map_symbol *ms = browser->b.priv;
struct symbol *sym = ms->sym;
struct annotation *notes = symbol__annotation(sym);
/* PLT symbols contain external offsets */ /* PLT symbols contain external offsets */
if (strstr(sym->name, "@plt")) if (strstr(sym->name, "@plt"))
...@@ -1000,7 +995,7 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser ...@@ -1000,7 +995,7 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser
if (++blt->jump_sources > notes->max_jump_sources) if (++blt->jump_sources > notes->max_jump_sources)
notes->max_jump_sources = blt->jump_sources; notes->max_jump_sources = blt->jump_sources;
++browser->nr_jumps; ++notes->nr_jumps;
} }
} }
...@@ -1093,7 +1088,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, ...@@ -1093,7 +1088,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
bpos->idx_asm = -1; bpos->idx_asm = -1;
} }
annotate_browser__mark_jump_targets(&browser, size); annotation__mark_jump_targets(notes, sym);
annotation__compute_ipc(notes, size); annotation__compute_ipc(notes, size);
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);
......
...@@ -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 nr_jumps;
int max_jump_sources; 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