STRUCT CYC_HIST(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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