CPU Frequency Scaling
CPU clock frequency scales up and down with the CPU usage as a way to reduce power usage. On Linux, this behavior is governed by the CPU governor.
The CPU frequency also scales down as a response to high temperature.
Linux's CPU frequency governor
You can check your current CPU governor by running:
# cpupower frequency-info --governors
analyzing CPU 0:
available cpufreq governors: performance powersave
Alternatively, you may check /sys/devices/system/cpu and see the setting for each CPU core.
# cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance
performance
performance
performance
performance
Types of governors
| Governor | Description |
|---|---|
| ondemand | Dynamically switch between CPU(s) available if at 95% CPU load |
| performance | Run the CPU at max frequency |
| conservative | Dynamically switch between CPU(s) available if at 75% load |
| powersave | Run the CPU at the minimum frequency |
| userspace | Run the CPU at user specified frequencies |
Intel Turbo Boost frequency
Some Intel CPUs support a turbo boost frequency where a CPU can clock faster than its stock speed depending on available power and thermal conditions. Refer to the CPU's specification to determine a particular CPU's turbo boost frequency.
I have observed on some compute servers that the CPU will run somewhere between the base frequency and the turbo boost frequency when the temperature is around the mid 70's Celsius when under full load. I'm not sure why this is the case.
Some helpful commands
| Description | Command |
|---|---|
| Get all CPU core frequencies | grep MHz /proc/cpuinfo
|
| Get average CPU core frequency | grep MHz /proc/cpuinfo | awk '{print $4}' | awk '{temp+=$1;n++} END{printf("%f", temp/n);}'
|
| Get max CPU core frequency | grep MHz /proc/cpuinfo | awk '{print $4}' | sort -rn | head -n 1
|
| Get min CPU core frequency | grep MHz /proc/cpuinfo | awk '{print $4}' | sort -n | head -n 1
|
| Get average CPU temperature | cat /sys/class/thermal/thermal_zone*/temp | awk '{temp+=$1;n++} END{printf("%f", temp/n/1000);}'
|
| Get max CPU temperature | cat /sys/class/thermal/thermal_zone*/temp | sort -rn | head -n 1 | awk '{printf("%f", $1/1000);}'
|