em_cpu_energy(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– em_cpu_energy(9) πŸ’–

okay so welcome to the em_cpu_energy page, bestie β€” straight out of the Kernel API Manual, section 9. this is the manpage for em_cpu_energy, and she is literally the vibe-check queen of energy estimation. let's get into it ✨


✨ NAME ✨

em_cpu_energy β€” estimates the energy consumed by the CPUs of a performance domain 🫢

like, if a performance domain is a group chat, this function tells you how much battery that group chat is draining. iconic.


🌸 SYNOPSIS 🌸

unsigned long em_cpu_energy (struct em_perf_domain *pd , unsigned long
max_util , unsigned long sum_util , unsigned long allowed_cpu_cap );

that's the whole signature, no cap. note she returns an unsigned long β€” she gives you a number back, she's generous like that πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • pd β€” the performance domain whose energy we're estimating. this is THE domain. main character energy fr.
  • max_util β€” the highest utilization among the CPUs of the domain. the peak, the busiest one, the one carrying the whole friend group 😭
  • sum_util β€” the sum of the utilization of all CPUs in the domain. everybody's contribution added up, teamwork slay.
  • allowed_cpu_cap β€” the maximum allowed CPU capacity for the pd, which might reflect a reduced frequency (due to thermal). yeah thermal said "chill" and lowered the ceiling 🌑️

πŸ¦‹ DESCRIPTION πŸ¦‹

okay listen, this is important:

this function must be used only for CPU devices. there is no validation β€” like, none, zero, nada. it does not check if the EM is a CPU type, and it does not check whether it has a cpumask allocated.

why no checks, you ask? because it's called from the scheduler code quite frequently, and that is why there are no checks. she's on the hot path, babe, she's booked and busy β€” ain't nobody got cycles for validation πŸ”₯

so bestie, the trust is fully on you. pass her a CPU device or it's giving undefined chaos πŸ’€


⭐ RETURN ⭐

she returns the sum of the energy consumed by the CPUs of the domain, assuming a capacity state satisfying the max utilization of the domain.

tl;dr: how much juice the whole domain slurps when it's running at the peak utilization state. chef's kiss πŸ‘‘


🌈 SEE ALSO 🌈

go read these too, iykyk, they're all connected:

like, the whole energy model fam. go say hi to all of them πŸ«ΆπŸ’œ


<div>🌸</div>

and that's the page, bestie!! πŸŽ€ this one lives in ./include/linux and the version/date stamp says October 2026 β€” so mark your calendar, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from