STRUCT CLOCK_DATA(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct clock_data(9) πŸ’…

okay bestie, gather round β€” this is the Kernel API Manual entry for struct clock_data, and it's literally all the data needed for sched_clock() (including registration of a new clock source). no cap, it's giving behind-the-scenes main character energy. 🫢

πŸŽ€ NAME πŸŽ€

struct clock_data β€” all data needed for sched_clock() (including registration of a new clock source)

✨ SYNOPSIS ✨

       struct clock_data {
           seqcount_latch_t seq;
           struct clock_read_data  read_data[2];
           ktime_t wrap_kt;
           unsigned long           rate;
           u64 (*actual_read_sched_clock)(void);
        };

🫢 Members 🫢

  • seq β€” sequence counter for protecting updates. the lowest bit is the index for read_data. so iconic of it. πŸ’…
  • read_data β€” data required to read from sched_clock.
  • wrap_kt β€” duration for which the clock can run before wrapping.
  • rate β€” tick rate of the registered clock.
  • actual_read_sched_clock β€” registered hardware level clock read function.

🌸 DESCRIPTION 🌸

the ordering of this structure has been chosen to optimize cache performance. specifically, 'seq' and 'read_data[0]' (combined) should fit into a single 64-byte cache line. yes bestie, that's the whole point β€” cache-line slay. ✨

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./kernel/time/sched_clock.c


mwah πŸ’‹ this lil page is brought to you by ./kernel/time, October 2026. go off, bestie. πŸŽ€

πŸ“¦ where this page comes from