Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: Namhyung 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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
6f94a72d f6b18aba

+6 -5
+3 -3
tools/perf/util/annotate.c
··· 1584 1584 double percent_max = 0.0; 1585 1585 int i; 1586 1586 1587 - for (i = 0; i < notes->nr_events; i++) { 1587 + for (i = 0; i < notes->src->nr_events; i++) { 1588 1588 double percent; 1589 1589 1590 1590 percent = annotation_data__percent(&al->data[i], ··· 1674 1674 if (al->offset != -1 && percent_max != 0.0) { 1675 1675 int i; 1676 1676 1677 - for (i = 0; i < notes->nr_events; i++) { 1677 + for (i = 0; i < notes->src->nr_events; i++) { 1678 1678 double percent; 1679 1679 1680 1680 percent = annotation_data__percent(&al->data[i], percent_type); ··· 1846 1846 return err; 1847 1847 1848 1848 annotation__init_column_widths(notes, sym); 1849 - notes->nr_events = nr_pcnt; 1849 + notes->src->nr_events = nr_pcnt; 1850 1850 1851 1851 annotation__update_column_widths(notes); 1852 1852 sym->annotate2 = 1;
+3 -2
tools/perf/util/annotate.h
··· 247 247 * to see each group separately, that is why symbol__annotate2() 248 248 * sets src->nr_histograms to evsel->nr_members. 249 249 * @samples: Hash map of sym_hist_entry. Keyed by event index and offset in symbol. 250 + * @nr_events: Number of events in the current output. 250 251 * @nr_entries: Number of annotated_line in the source list. 251 252 * @nr_asm_entries: Number of annotated_line with actual asm instruction in the 252 253 * source list. ··· 266 265 struct sym_hist *histograms; 267 266 struct hashmap *samples; 268 267 int nr_histograms; 268 + int nr_events; 269 269 int nr_entries; 270 270 int nr_asm_entries; 271 271 int max_jump_sources; ··· 313 311 314 312 struct LOCKABLE annotation { 315 313 u64 start; 316 - int nr_events; 317 314 struct annotated_source *src; 318 315 struct annotated_branch *branch; 319 316 }; ··· 336 335 337 336 static inline int annotation__pcnt_width(struct annotation *notes) 338 337 { 339 - return (symbol_conf.show_total_period ? 12 : 7) * notes->nr_events; 338 + return (symbol_conf.show_total_period ? 12 : 7) * notes->src->nr_events; 340 339 } 341 340 342 341 static inline bool annotation_line__filter(struct annotation_line *al)