get_cpu_iowait_time_us(9)
π get_cpu_iowait_time_us(9) β the Kernel API Manual, bestie edition
okay so this is a page straight out of the Kernel API Manual, and it's about get_cpu_iowait_time_us β literally the function that tells you how long a CPU has been sitting around waiting on I/O. no cap, it's a whole vibe check on your scheduler. π¦
β¨ NAME β¨
get_cpu_iowait_time_us β get the total iowait time of a CPU
πΈ SYNOPSIS πΈ
u64 get_cpu_iowait_time_us (int cpu , u64 *last_update_time );
π ARGUMENTS π
cpuβ the CPU number you're querying, like "which core are we checking bestie" πlast_update_timeβ a variable where the update time gets stored. > if this isNULL, the counters just don't get updated. no biggie, just fyi.
π¦ DESCRIPTION π¦
So the way that this works: it returns the cumulative iowait time (since boot) for whatever CPU you point at, measured in microseconds. iconic. β
ngl though, it's partially broken β and I'm gonna say that louder because it matters:
β οΈ the counter of iowait tasks can be remotely updated without any synchronization, so it is possible to observe backward values within two consecutive reads. yeah. you read that right. two reads in a row and the second one can be lower. π
Also for the record: this time is measured via accounting rather than sampling, and it's as accurate as ktime_get is. so like, that's the accuracy benchmark, periodt.
π RETURN π
total iowait time of cpu β that's it, that's the whole return value π
π SEE ALSO π
- Kernel file
./kernel/sched/cputime.c get_cpu_idle_time_us(9)
okay so that's the whole page π«Ά β and for the cute sign-off: this little beauty lives under ./kernel/sched in the source tree, dated October 2026, and it's get_cpu_iowait_time_us(9) through and through. go check your iowait, bestie, and don't panic if it goes backwards πβ¨
π¦ 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