STRUCT CLOCK_READ_DATA(9)
π struct clock_read_data(9) π
okay so bestie, welcome to the Kernel API Manual β¨ we're talking about struct clock_read_data today and honestly it's lowkey iconic π
πΈ NAME πΈ
struct clock_read_data β the data you literally need to read from sched_clock() π«Ά
β¨ SYNOPSIS β¨
struct clock_read_data {
u64 epoch_ns;
u64 epoch_cyc;
u64 sched_clock_mask;
u64 (*read_sched_clock)(void);
u32 mult;
u32 shift;
};
π¦ Members π¦
epoch_nsβ thesched_clockvalue at the last update, periodt β¨epoch_cycβ clock cycle value at the last update πsched_clock_maskβ the bitmask for two's complement subtraction of non 64bit clocks, no cap π§read_sched_clockβ the current clock source (or the dummy source when suspended β yes, it has a standby era π)multβ multiplier for the scaled math conversion, it ate π₯shiftβ shift value for the scaled math conversion π
π Description π
okay so listen π care must be taken when updating this structure β it's read by some very hot code paths π₯π₯π₯ she's main character energy but she's on the fast path so be nice to her.
it occupies <=40 bytes and, when combined with the seqcount used to synchronize access, comfortably fits into a 64 byte cache line πΈ like yes she's compact, she's efficient, she's that girl π
ngl this is genuinely a caution, not a vibe: get the update wrong and the hot paths feel it π
π SEE ALSO π
- Kernel file
./include/linux/sched_clock.hπ«Ά
and that's the whole page bestie, ty for coming to my ted talk π this was brought to you straight out of ./include/linux, dated October 2026, and yes it's still struct clock_read_data(9) β slay π
β¨ππ¦
π¦ 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