Commit f6b18aba authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf annotate: Move 'max_jump_sources' struct to 'struct annotated_source'

It's only used in 'perf annotate' output which means functions with actual
samples.  No need to consume memory for every symbol ('struct annotation').
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240404175716.1225482-8-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a46acc45
...@@ -49,7 +49,7 @@ static int ui_browser__jumps_percent_color(struct ui_browser *browser, int nr, b ...@@ -49,7 +49,7 @@ static int ui_browser__jumps_percent_color(struct ui_browser *browser, int nr, b
if (current && (!browser->use_navkeypressed || browser->navkeypressed)) if (current && (!browser->use_navkeypressed || browser->navkeypressed))
return HE_COLORSET_SELECTED; return HE_COLORSET_SELECTED;
if (nr == notes->max_jump_sources) if (nr == notes->src->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;
......
...@@ -1373,8 +1373,8 @@ annotation__mark_jump_targets(struct annotation *notes, struct symbol *sym) ...@@ -1373,8 +1373,8 @@ annotation__mark_jump_targets(struct annotation *notes, struct symbol *sym)
if (target == NULL) if (target == NULL)
continue; continue;
if (++target->jump_sources > notes->max_jump_sources) if (++target->jump_sources > notes->src->max_jump_sources)
notes->max_jump_sources = target->jump_sources; notes->src->max_jump_sources = target->jump_sources;
} }
} }
...@@ -1432,7 +1432,7 @@ annotation__init_column_widths(struct annotation *notes, struct symbol *sym) ...@@ -1432,7 +1432,7 @@ annotation__init_column_widths(struct annotation *notes, struct symbol *sym)
notes->src->widths.addr = notes->src->widths.target = notes->src->widths.addr = notes->src->widths.target =
notes->src->widths.min_addr = hex_width(symbol__size(sym)); notes->src->widths.min_addr = hex_width(symbol__size(sym));
notes->src->widths.max_addr = hex_width(sym->end); notes->src->widths.max_addr = hex_width(sym->end);
notes->src->widths.jumps = width_jumps(notes->max_jump_sources); notes->src->widths.jumps = width_jumps(notes->src->max_jump_sources);
notes->src->widths.max_ins_name = annotation__max_ins_name(notes); notes->src->widths.max_ins_name = annotation__max_ins_name(notes);
} }
......
...@@ -250,6 +250,8 @@ struct cyc_hist { ...@@ -250,6 +250,8 @@ struct cyc_hist {
* @nr_entries: Number of annotated_line in the source list. * @nr_entries: Number of annotated_line in the source list.
* @nr_asm_entries: Number of annotated_line with actual asm instruction in the * @nr_asm_entries: Number of annotated_line with actual asm instruction in the
* source list. * source list.
* @max_jump_sources: Maximum number of jump instructions targeting to the same
* instruction.
* @widths: Precalculated width of each column in the TUI output. * @widths: Precalculated width of each column in the TUI output.
* *
* disasm_lines are allocated, percentages calculated and all sorted by percentage * disasm_lines are allocated, percentages calculated and all sorted by percentage
...@@ -265,6 +267,7 @@ struct annotated_source { ...@@ -265,6 +267,7 @@ struct annotated_source {
int nr_histograms; int nr_histograms;
int nr_entries; int nr_entries;
int nr_asm_entries; int nr_asm_entries;
int max_jump_sources;
struct { struct {
u8 addr; u8 addr;
u8 jumps; u8 jumps;
...@@ -309,7 +312,6 @@ struct annotated_branch { ...@@ -309,7 +312,6 @@ struct annotated_branch {
struct LOCKABLE annotation { struct LOCKABLE annotation {
u64 start; u64 start;
int nr_events; int nr_events;
int max_jump_sources;
struct annotated_source *src; struct annotated_source *src;
struct annotated_branch *branch; struct annotated_branch *branch;
}; };
......
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