thread_group_sample_cputime(9)
π thread_group_sample_cputime β¨
ok so bestie, welcome to the Kernel API Manual entry for thread_group_sample_cputime β yes that's a mouthful, yes it's iconic, and yes we're gonna get through it together π«Ά
πΈ NAME πΈ
thread_group_sample_cputime β sample cputime for a given task β±οΈβ¨
π SYNOPSIS π
void thread_group_sample_cputime (struct task_struct *tsk , u64 *samples );
literally that's the whole signature. no cap. π
π¦ ARGUMENTS π¦
tskβ the task whose cputime needs to be started πsamplesβ your storage spot for the time samples, aka where the numbers go π
π₯ DESCRIPTION π₯
okay so here's the vibe: this one gets called from sys_getitimer to calculate the expiry time of an active timer. which means β and this is the important part, bestie β group cputime accounting is already active. it also gets called with the task sighand lock held, so don't go doing anything weird in there, iykyk π
what does it actually do? it updates the times with an up-to-date sample of the thread group cputimes. that's it. that's the whole job. main character energy, minimal drama β¨
π SEE ALSO π
- Kernel file
./kernel/time/posix-cpu-timers.cπ thread_group_start_cputime(9)task_cputimers_expired(9)fastpath_timer_check(9)
go read those too, fr fr, they're all besties π
ngl if you skimmed all of that, the takeaway is: it samples cputime for a task's thread group, it's called fromsys_getitimerwith thesighandlock held, and group cputime accounting is already active when you get here. periodt π
and that's the page!! π§ this little gem lives under ./kernel/time and it's dated October 2026 β mwah, sending you off with a kiss and a π, go forth and sample those cputimes 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