Cpufrequtils
Dynamic CPU frequency scaling (also known as CPU throttling) is a technique in computer architecture where a processor is run at a less-than-maximum frequency in order to conserve power.
Here is a setup process using “cpufrequtils”.
1. Install "cpufrequtils"
- target
$ sudo apt-get install cpufrequtils
2. Set governor and cpu speed
You need to create /etc/default/cpufrequtils file and fill it as the following format.
- target
$ sudo vi /etc/default/cpufrequtils
- target
ENABLE="true" GOVERNOR="ondemand" MAX_SPEED=1536000 MIN_SPEED=100000
You can check the available list of governor and cpu speed under those nodes.
/sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors
/sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
3. Restart cpufrequtils service
Restart cpufrequtils service.
- target
$ sudo service cpufrequtils restart
Then, you can check the cpufreq info is updated.
- target
$ cpufreq-info -o minimum CPU frequency - maximum CPU frequency - governor CPU 0 100000 kHz ( 6 %) - 1536000 kHz (100 %) - ondemand CPU 1 100000 kHz ( 6 %) - 1536000 kHz (100 %) - ondemand CPU 2 100000 kHz ( 6 %) - 1536000 kHz (100 %) - ondemand CPU 3 100000 kHz ( 6 %) - 1536000 kHz (100 %) - ondemand
4. [Option] Ubuntu 18.04 - Disable ondemand.service using systemctl
In case of Ubuntu 18.04, ondemand.service overrides the default governor, so you should disable it to use cpufrequtils.
- target
$ sudo systemctl disable ondemand
If you want to restore this service as default, please use this command.
- target
$ sudo systemctl enable ondemand
Set-up Examples
[Example] ODROID-N2
Available governor and cpu frequency sets
- target
$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors ondemand powersave userspace conservative interactive performance schedutil
- target
$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies 100000 250000 500000 667000 1000000 1200000 1398000 1512000 1608000 1704000 1896000 $ cat /sys/devices/system/cpu/cpufreq/policy2/scaling_available_frequencies 100000 250000 500000 667000 1000000 1200000 1398000 1512000 1608000 1704000 1800000
cpufrequtils option
- target
$ sudo vi /etc/default/cpufrequtils ENABLE="true" GOVERNOR="ondemand"
cpufreq-info
- target
$ sudo service cpufrequtils restart $ cpufreq-info -o minimum CPU frequency - maximum CPU frequency - governor CPU 0 100000 kHz ( 5 %) - 1896000 kHz (100 %) - ondemand CPU 1 100000 kHz ( 5 %) - 1896000 kHz (100 %) - ondemand CPU 2 100000 kHz ( 5 %) - 1800000 kHz (100 %) - ondemand CPU 3 100000 kHz ( 5 %) - 1800000 kHz (100 %) - ondemand CPU 4 100000 kHz ( 5 %) - 1800000 kHz (100 %) - ondemand CPU 5 100000 kHz ( 5 %) - 1800000 kHz (100 %) - ondemand
[Example] ODROID-XU3/XU4
Available governor and cpu frequency sets
- target
$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors conservative userspace powersave ondemand performance schedutil
- target
$ cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies 200000 300000 400000 500000 600000 700000 800000 900000 1000000 1100000 1200000 1300000 1400000 1500000 $ cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies 200000 300000 400000 500000 600000 700000 800000 900000 1000000 1100000 1200000 1300000 1400000 1500000 1600000 1700000 1800000 1900000 2000000
cpufrequtils option
- target
$ sudo vi /etc/default/cpufrequtils ENABLE="true" GOVERNOR="ondemand"
cpufreq-info
- target
$ sudo service cpufrequtils restart $ cpufreq-info -o minimum CPU frequency - maximum CPU frequency - governor CPU 0 200000 kHz ( 13 %) - 1500000 kHz (100 %) - ondemand CPU 1 200000 kHz ( 13 %) - 1500000 kHz (100 %) - ondemand CPU 2 200000 kHz ( 13 %) - 1500000 kHz (100 %) - ondemand CPU 3 200000 kHz ( 13 %) - 1500000 kHz (100 %) - ondemand CPU 4 200000 kHz ( 10 %) - 2000000 kHz (100 %) - ondemand CPU 5 200000 kHz ( 10 %) - 2000000 kHz (100 %) - ondemand CPU 6 200000 kHz ( 10 %) - 2000000 kHz (100 %) - ondemand CPU 7 200000 kHz ( 10 %) - 2000000 kHz (100 %) - ondemand
[Example] ODROID-C2
Available governor and cpu frequency sets
- target
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors hotplug interactive conservative ondemand userspace powersave performance
- target
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 100000 250000 500000 1000000 1296000 1536000
cpufrequtils option
- target
$ sudo vi /etc/default/cpufrequtils ENABLE="true" GOVERNOR="performance" MAX_SPEED=1536000 MIN_SPEED=100000
cpufreq-info
- target
$ sudo service cpufrequtils restart $ cpufreq-info -o minimum CPU frequency - maximum CPU frequency - governor CPU 0 100000 kHz ( 6 %) - 1536000 kHz (100 %) - performance CPU 1 100000 kHz ( 6 %) - 1536000 kHz (100 %) - performance CPU 2 100000 kHz ( 6 %) - 1536000 kHz (100 %) - performance CPU 3 100000 kHz ( 6 %) - 1536000 kHz (100 %) - performance
[Example] ODROID-C1
Available governor and cpu frequency sets
- target
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors hotplug interactive conservative ondemand performance
- target
$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 96000 192000 312000 408000 504000 600000 696000 816000 912000 1008000 1104000 1200000 1296000 1416000 1488000 1536000 1632000 1728000 1824000
cpufrequtils option
- target
$ sudo vi /etc/default/cpufrequtils ENABLE="true" GOVERNOR="ondemand" MAX_SPEED=1824000 MIN_SPEED=100000
cpufreq-info
- target
$ sudo service cpufrequtils restart $ cpufreq-info -o minimum CPU frequency - maximum CPU frequency - governor CPU 0 96000 kHz ( 5 %) - 1824000 kHz (100 %) - ondemand CPU 1 96000 kHz ( 5 %) - 1824000 kHz (100 %) - ondemand CPU 2 96000 kHz ( 5 %) - 1824000 kHz (100 %) - ondemand CPU 3 96000 kHz ( 5 %) - 1824000 kHz (100 %) - ondemand