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

perf annotate: Move nr_events 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-9-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f6b18aba
...@@ -1584,7 +1584,7 @@ static double annotation_line__max_percent(struct annotation_line *al, ...@@ -1584,7 +1584,7 @@ static double annotation_line__max_percent(struct annotation_line *al,
double percent_max = 0.0; double percent_max = 0.0;
int i; int i;
for (i = 0; i < notes->nr_events; i++) { for (i = 0; i < notes->src->nr_events; i++) {
double percent; double percent;
percent = annotation_data__percent(&al->data[i], percent = annotation_data__percent(&al->data[i],
...@@ -1674,7 +1674,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati ...@@ -1674,7 +1674,7 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
if (al->offset != -1 && percent_max != 0.0) { if (al->offset != -1 && percent_max != 0.0) {
int i; int i;
for (i = 0; i < notes->nr_events; i++) { for (i = 0; i < notes->src->nr_events; i++) {
double percent; double percent;
percent = annotation_data__percent(&al->data[i], percent_type); percent = annotation_data__percent(&al->data[i], percent_type);
...@@ -1846,7 +1846,7 @@ int symbol__annotate2(struct map_symbol *ms, struct evsel *evsel, ...@@ -1846,7 +1846,7 @@ int symbol__annotate2(struct map_symbol *ms, struct evsel *evsel,
return err; return err;
annotation__init_column_widths(notes, sym); annotation__init_column_widths(notes, sym);
notes->nr_events = nr_pcnt; notes->src->nr_events = nr_pcnt;
annotation__update_column_widths(notes); annotation__update_column_widths(notes);
sym->annotate2 = 1; sym->annotate2 = 1;
......
...@@ -247,6 +247,7 @@ struct cyc_hist { ...@@ -247,6 +247,7 @@ struct cyc_hist {
* to see each group separately, that is why symbol__annotate2() * to see each group separately, that is why symbol__annotate2()
* sets src->nr_histograms to evsel->nr_members. * sets src->nr_histograms to evsel->nr_members.
* @samples: Hash map of sym_hist_entry. Keyed by event index and offset in symbol. * @samples: Hash map of sym_hist_entry. Keyed by event index and offset in symbol.
* @nr_events: Number of events in the current output.
* @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.
...@@ -265,6 +266,7 @@ struct annotated_source { ...@@ -265,6 +266,7 @@ struct annotated_source {
struct sym_hist *histograms; struct sym_hist *histograms;
struct hashmap *samples; struct hashmap *samples;
int nr_histograms; int nr_histograms;
int nr_events;
int nr_entries; int nr_entries;
int nr_asm_entries; int nr_asm_entries;
int max_jump_sources; int max_jump_sources;
...@@ -311,7 +313,6 @@ struct annotated_branch { ...@@ -311,7 +313,6 @@ struct annotated_branch {
struct LOCKABLE annotation { struct LOCKABLE annotation {
u64 start; u64 start;
int nr_events;
struct annotated_source *src; struct annotated_source *src;
struct annotated_branch *branch; struct annotated_branch *branch;
}; };
...@@ -335,7 +336,7 @@ static inline int annotation__cycles_width(struct annotation *notes) ...@@ -335,7 +336,7 @@ static inline int annotation__cycles_width(struct annotation *notes)
static inline int annotation__pcnt_width(struct annotation *notes) static inline int annotation__pcnt_width(struct annotation *notes)
{ {
return (symbol_conf.show_total_period ? 12 : 7) * notes->nr_events; return (symbol_conf.show_total_period ? 12 : 7) * notes->src->nr_events;
} }
static inline bool annotation_line__filter(struct annotation_line *al) static inline bool annotation_line__filter(struct annotation_line *al)
......
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