get_cpu_idle_time_us(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ get_cpu_idle_time_us(9) ✨

okay so bestie, this is a page from the Kernel API Manual (yes, the kernel has a manual, and yes it's kinda iconic) β€” it's all about get_cpu_idle_time_us, and honestly? It does exactly what it says on the tin. Let's get into it 🫢


🌸 NAME 🌸

get_cpu_idle_time_us β€” get the total idle time of a CPU

⭐ SYNOPSIS ⭐

u64 get_cpu_idle_time_us (int cpu , u64 *last_update_time );

πŸŽ€ ARGUMENTS πŸŽ€

  • cpu β€” the CPU number you wanna query, like "which core are we talking about here" πŸ’…
  • last_update_time β€” a variable where the update time gets stored. Lowkey important caveat: do not update counters if this is NULL.

πŸ¦‹ DESCRIPTION πŸ¦‹

So what it does is return the cumulative idle time for a given CPU β€” that's since boot, babe β€” in microseconds. ⏱️

⚠️ But listen: this is partially broken because of the counter of iowait tasks, which can be remotely updated without any synchronization. Translation? You might literally observe backward values within two consecutive reads. Not a vibe, but it's the truth 😭

The time is measured via accounting rather than sampling, and it's as accurate as ktime_get is. No cap. ✨

πŸ‘‘ RETURN πŸ‘‘

The total idle time of the cpu. That's it, that's the tea. πŸ“

🌈 SEE ALSO 🌈


and that's the whole page, bestie πŸ’– it's from ./kernel/sched, dated October 2026, and it lives in the Kernel API Manual β€” go forth and query your idle times, you absolute main character πŸ§šβ€β™€οΈπŸ’œ

πŸ“¦ where this page comes from