STRUCT CLOCKSOURCE_HW_SNAPSHOT(9)
β¨ struct clock..._hw_snapshot(9) β¨
okay bestie, welcome to the Kernel API Manual π β this one's a struct page, and it's honestly kind of a big deal. Let's get into it π«Ά
πΈ NAME πΈ
struct clocksource_hw_snapshot β a Snapshot for the underlying hardware counter of derived clocksources like kvmclock or Hyper-V scaled TSC π°οΈβ¨
π¦ SYNOPSIS π¦
struct clocksource_hw_snapshot {
u64 hw_cycles;
enum clocksource_ids hw_csid;
};
like. that's the whole thing. two members. main character energy fr π
π Members π
hw_cyclesβ The hardware counter value π literally just the raw hardware counter, sitting there, being au64hw_csidβ Clocksource ID of the hardware counter π·οΈ so you know which hardware counter we're talking about
β Description β
okay so here's the vibe: clocksources like this one (the derived ones, iykyk) must implement the read_snapshot callback π€ no skipping, no cap.
And that callback has to:
- fill in the hardware counter value β
- fill in the clocksource ID of the hardware counter β
- derive the actual clocksource cycles from
hw_cyclesβ
β¦and the whole point of doing all that? so the thing can provide an atomic snapshot π₯ that's it, that's the goal, and it's iconic.
β οΈ lowkey important: the word "must" is doing real work here β the callback is required, not optional π
π SEE ALSO π
go look at the Kernel file ./include/linux/clocksource.h for these besties π«Ά:
struct clocksource(9)clocksource_khz2mult(9)clocksource_hz2mult(9)clocksource_cyc2ns(9)struct clocksource_base(9)
and that's the page!! π sign-off time: this lil slice of kernel lore lives in ./include/linux, dated October 2026, and it's filed under struct clock..._hw_snapshot(9) β the ellipsis is not a typo, it's a lifestyle ππ go read your clocksources bestie!! π§β¨
π¦ 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