STRUCT ANNOTATED_BRANCH(9)
β¨ NAME β¨
struct annotated_branch β the whole entire lowdown on basic blocks and IPC info for a symbol, bestie π
okay so real quick before we dive in: this is a Kernel API Manual page (yes, the (9) girlies, section 9, kernel API) and honestly? she's giving main character energy. let's get into it π«Ά
πΈ SYNOPSIS πΈ
struct annotated_branch {
u64 hit_cycles;
u64 hit_insn;
unsigned int total_insn;
unsigned int cover_insn;
struct cyc_hist *cycles_hist;
u64 max_coverage;
u64 *br_cntr;
};
no cap, that's the whole shape of her. now let's meet the members one by one π
π Members π
hit_cyclesβ total executed cycles. literally the cycle count, periodt. π₯hit_insnβ total number of instructions executed. the way she just counts insns for you, obsessed.total_insnβ number of instructions in the function. (unsigned int, so she's got limits, iykyk)cover_insnβ number of distinct instructions that were actually executed. distinct!! not just any old repeat, okay? πcycles_histβstruct cyc_hist *, an array ofcyc_histfor each instruction. one per instruction bestie, a whole little lineup π§max_coverageβ maximum number of covered basic block (used for block-range). she's au64and she's holding the ceiling for you πbr_cntrβu64 *, array of the occurrences of events (branch counters) during a block. counting branches like it's her job, because it is π
π¦ Description π¦
so this struct is used by two different codes when the sample has branch stack and cycles information. two codes, one struct, we love a shared-usage moment π«Ά
Here's the tea on who does what:
annotation__compute_ipccalculates average IPC usinghit_insn / hit_cycles. math! slay! β- The actual coverage can be calculated using
cover_insn / total_insn. another ratio, another vibe check. - The
cycles_histcan give IPC for each (longest) basic block ends at the given address. yes, longest β that's the qualifier, don't come for me. process_basic_blockcalculates coverage of instructions (or basic blocks) in the function.
and that's it, that's the whole description, no extra lore, no invented features, we stay factual in this group chat π
π SEE ALSO π
Kernel file ./tools/perf/util/annotate.h plus the whole friend group:
struct sym_hist(9)struct cyc_hist(9)struct annotated_source(9)struct annotated_op_loc(9)struct annotated_insn_loc(9)struct annotated_basic_block(9)
go read them, they're literally iconic, fr fr π
ngl the manual name isstruct annotated_branch(9)from Kernel API Manual β and this page lives in./tools/perf/util, October 2026 edition. that's the footer, folded into a sign-off because we're cute like that. byeeee β¨ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms