STRUCT CYC_HIST(9)
β¨ struct cyc_hist(9) β¨
okay bestie, so this is a page straight outta the Kernel API Manual π
and it's all about struct cyc_hist β that's literally the (CPU) cycle histogram for a basic block. yes. we're doing kernel profiling today. put ur hair up, it's gonna be cute π
πΈ NAME πΈ
struct cyc_hist β the (CPU) cycle histogram for a basic block. that's her. that's the whole vibe. π¦
β¨ SYNOPSIS β¨
struct cyc_hist {
u64 start;
u64 cycles;
u64 cycles_aggr;
u64 cycles_max;
u64 cycles_min;
s64 cycles_spark[NUM_SPARKS];
u32 num;
u32 num_aggr;
u8 have_start;
u16 reset;
};
look at her. all those little fields. so organized. we love a structured queen π
π«Ά Members π«Ά
startβ start address of the current block (if we know it π).cyclesβ the sum of cycles for the longest basic block. the main character block, if u will.cycles_aggrβ total cycles for this address. the whole squad's contribution πcycles_maxβ max cycles for this address. the overachiever.cycles_minβ min cycles for this address. the lowkey one.cycles_sparkβ history of cycles for the longest basic block β¨ sparkle sparkle β¨numβ number of samples for the longest basic block.num_aggrβ total number of samples for this address.have_startβ whether the current branch info actually has a start address. a yes/no moment.resetβ number of resets due to a different start address. (she's been through some things π)
π Description π
so here's the tea π: if a sample has branch_stack and cycles info, it can construct basic blocks between two adjacent branches. it'd have start and end addresses β but sometimes the start address just isn't available, no cap. so instead, the cycles get accounted at the end address. and if multiple basic blocks end at the same address? it takes the longest one. longest block wins, periodt. π
the start, cycles, cycles_spark and num fields are used for the longest block only. all the other fields are used for all cases. don't mix that up bestie, iykyk π
also, see __symbol__account_cycles. go look at her. she knows things.
π SEE ALSO π
- Kernel file
./tools/perf/util/annotate.hβ that's where the lore lives π struct sym_hist(9)struct annotated_source(9)struct annotated_branch(9)struct annotated_op_loc(9)struct annotated_insn_loc(9)struct annotated_basic_block(9)
k that's the whole page, u ate that fr fr π₯ and a cute little sign-off for u: this one lives in ./tools/perf/util and it's dated October 2026 β iconic, timeless, exactly as the kernel gods intended πβ¨π
π¦ 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