Dup Goto 📝

MinimumPower

PT2/linux/cpupower 05-25 07:11:56
To Pop
22 lines, 109 words, 649 chars Saturday 2024-05-25 07:11:56

To set CPU power at its lowest (perhaps to stretch battery life), use cpufreq. To install this:

sudo apt-get install linux-tools-$(uname -r)

And then to use (as root)

cpupower frequency-set -g powersave
N=4 # number of cores
for s in $(seq 1 $((N-1))); do
  echo 0 > /sys/devices/system/cpu/cpu${s}/online
done

and use

echo 1 > /sys/devices/system/cpu/cpu${s}/online

to enable a core.

If editing code with vim, I can happily work in this lowest power mode on a Thinkpad T450, even under Kubuntu. On the other hand, as soon as you load a heavy website in Chrome (or an electron app), the CPU restriction becomes obvious.