STRUCT ANNOTATED_SOURCE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

struct annotated_source β€” bestie, when your symbols have hits, this is the little struct that gets attached to them, inside the annotation ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

       struct annotated_source {
           struct list_head        source;
           struct sym_hist         *histograms;
           struct hashmap          *samples;
           int nr_histograms;
           int nr_events;
           int nr_entries;
           int nr_asm_entries;
           int max_jump_sources;
           bool tried_source;
           u64 start;
           struct {
             u8 addr;
             u8 jumps;
             u8 target;
             u8 min_addr;
             u8 max_addr;
             u8 max_ins_name;
             u16 max_line_len;
           } widths;
        };

πŸŽ€ Members πŸŽ€

  • source β€” the list head for annotated_line (which is embeded in disasm_line, okurrr) πŸ’…
  • histograms β€” an array of symbol histograms, one per event, holding onto the total number of samples and the period 🌸
  • samples β€” a hash map of sym_hist_entry, keyed by event index plus the offset in the symbol πŸ—ΊοΈ
  • nr_histograms β€” lowkey this might not equal evsel->evlist->core.nr_entries if you've got more than a group in a evlist, because then we want to see each group separately β€” that's literally why symbol__annotate2 sets src->nr_histograms to evsel->nr_members 🧚
  • nr_events β€” number of events in the current output ✨
  • nr_entries β€” number of annotated_line in the source list πŸŽ€
  • nr_asm_entries β€” number of annotated_line that actually have a real asm instruction in the source list πŸ‘‘
  • max_jump_sources β€” the maximum number of jump instructions all targeting the same instruction, no cap 🏹
  • widths β€” precalculated width of each column in the TUI output, so the table doesn't wobble on you πŸ“

πŸ’€ Description πŸ’€

So here's the vibe: the disasm_lines get allocated, percentages get calculated, and everything gets sorted by percentage right when the annotation is about to be presented. Which means those percentages are for one of the entries in the histogram array β€” i.e. for the event/counter currently being presented, not some mix of everything. Main character energy only πŸ’…

And then it gets deallocated right after symbol__{tui,tty,etc}_annotate returns. Gone. Poof. 🫢

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./tools/perf/util/annotate.h, plus the whole friend group: struct sym_hist(9), struct cyc_hist(9), struct annotated_branch(9), struct annotated_op_loc(9), struct annotated_insn_loc(9), struct annotated_basic_block(9) ⭐


ngl bestie, go read those other structs too, iykyk πŸ’–

That's the whole page, mwah πŸ“ β€” brought to you from ./tools/perf/util, dated October 2026, slay πŸŽ€βœ¨

πŸ“¦ where this page comes from