clocksource_...spend_timing(9)
β¨ clocksource_...spend_timing(9) β a Kernel API Manual moment β¨
okay bestie, buckle up, because we're diving into the Kernel API Manual and this one is a lil function with a big job π it's called clocksource_start_suspend_timing, and honestly? it's giving "quiet hero of the suspend arc."
πΈ NAME πΈ
clocksource_start_suspend_timing β literally just starts measuring the suspend timing π
that's it, that's the whole vibe.
π¦ SYNOPSIS π¦
void clocksource_start_suspend_timing (struct clocksource *cs , u64
start_cycles );
no cap, that's the whole signature π«Ά
π ARGUMENTS π
csβ the current clocksource from timekeeping. yes queen, the one timekeeping is using right now β¨start_cyclesβ the current cycles from timekeeping. this is the starting number we're gonna hold onto π
π DESCRIPTION π
so what does this actually do? bestie, it saves the start cycle values of the suspend timer so that when the system resumes, we can calculate the suspend time π like a little "we left at 3:47pm" sticky note for your kernel. iconic behavior honestly.
and the timing of when it gets called is so specific β it's called late in the suspend process, from timekeeping_suspend. by that point processes are frozen, non-boot cpus and interrupts are disabled. so everything is quiet, everything is chill, nobody's touching anything π
and because of that whole frozen situation, it's therefore possible to start the suspend timer without taking the clocksource mutex π and that's the whole reason this works the way it works. main character energy.
π SEE ALSO π
this function does not roll alone, bestie β here's the whole friend group from the kernel file ./kernel/time/clocksource.c:
clocks_calc_mult_shift(9)clocksource_mark_unstable(9)clocksource_suspend_select(9)clocksource_stop_suspend_timing(9)clocksource_suspend(9)clocksource_resume(9)clocksource_touch_watchdog(9)clocksource_max_adjustment(9)clocks_calc_max_nsecs(9)clocksource_update_max_deferment(9)clocksource_select(9)__clocksource_update_freq_scale(9)__clocksource_register_scale(9)clocksource_unregister(9)current_clocksource_show(9)current_clocksource_store(9)unbind_clocksource_store(9)available_clocksource_show(9)boot_override_clocksource(9)boot_override_clock(9)
lowkey the whole clocksource squad is here. iykyk π
and that's the page, bestie! π§ this lil gem lives in ./kernel/time, dated October 2026, cheerfully stamped with the Kernel API Manual name up top π
β¨ go forth and measure your suspend timing, periodt. ππ
π¦ 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