get_cpu_iowait_time_us(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ 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 is NULL, 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 🌈


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