em_cpu_energy(9)
π 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 thepd, 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:
- Kernel file
./include/linux/energy_model.h struct em_perf_state(9)struct em_perf_table(9)struct em_perf_domain(9)em_pd_get_efficient_state(9)em_pd_nr_perf_states(9)em_perf_state_from_pd(9)
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
- 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