cpufreq_get_requested_power(9)
π cpufreq_get_requested_power(9) π
okay so bestie, this is a page from the Kernel API Manual and honestly it's giving "thermal management but make it cute". Let's get into it β¨
π NAME π
cpufreq_get_requested_power β get the current power
β¨ SYNOPSIS β¨
int cpufreq_get_requested_power (struct thermal_cooling_device *cdev ,
u32 *power );
πΈ ARGUMENTS πΈ
cdevβ athermal_cooling_devicepointer, iykyk π«Άpowerβ the pointer where we're gonna stash the resulting power, no cap
π¦ DESCRIPTION π¦
So the whole glowy mission here: calculate the current power consumption of the cpus in milliwatts and store it in power. Slay. β‘
now, real talk β this function should actually calculate the requested power, but ngl that's hard. Like, genuinely hard. Getting the frequency that cpufreq would have assigned if there were no thermal limits? That's the dream, but it's not it. Instead, we calculate the current power on the assumption that the immediate future will look like the immediate past. main character energy: past behavior predicts future vibes π
We use the current frequency and the average load since this function was last called. And like β in reality there could have been multiple opps since this function was last called, and that lowkey affects the load calculation. So it's not perfectly accurate, but this simplification is good enough and it works. Fr fr.
REVISIT this, as more complex code may be needed if experiments show that it's not accurate enough. π (yes that's literally in the original, it's a vibe check for future maintainers)
π RETURN π
0 on success β and that's it, bestie, this function doesn't fail. Not once. Iconic. π
π SEE ALSO π
- Kernel file
./drivers/thermal/cpufreq_cooling.c struct time_in_idle(9)struct cpufreq_cooling_device(9)get_level(9)get_load(9)get_dynamic_power(9)cpufreq_state2power(9)cpufreq_power2state(9)cpufreq_get_max_state(9)cpufreq_get_cur_state(9)cpufreq_set_cur_state(9)__cpufreq_cooling_register(9)cpufreq_cooling_register(9)of_cpufreq_cooling_register(9)cpufreq_cooling_unregister(9)
like, go read those too, they're all part of the same friend group π«Άβ¨
and that's the whole page!! π sign-off time: this lil beauty lives in ./drivers/thermal, dated October 2026, and it's filed under cpufreq_get_requested_power(9). mwah π stay cool (literally, it's a cooling device) πΈπ
π¦ 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