Auto-CPUfreq – A CPU speed optimizer for Linux

Save Your Battery On Laptops!

Auto-CPUFreq is an open-source tool which is an automatic CPU speed and power optimizer for Linux desktops. If you are using your laptop on battery, then it reduces the frequency of your CPU and if you launch any resource-heavy task which increases the system load, then it increases the CPU frequency (and the power usage). It is similar to other tools such as Powertop and TLP, however, it pretty much does the job automatically instead of allowing the users to configure the battery state and CPU clock speed manually.

The only disadvantage of using Linux on Laptops is that it devours the laptop’s battery very quickly, and therefore you always have to carry a charger whereas on a Desktop, you don’t have to worry about it. And even the life span of your Laptop battery decreases as it goes through numerous charge cycles in quick succession. This tool attempts to solve this problem.

In this tutorial, we will look at the installation procedure of this tool and also try to configure our CPU using it so that we maximize the battery life of our system.

Also read: CPU-X: A Linux alternative for CPU-Z

Installing Auto-CPUFreq

Just open a Terminal window and type the following command, regardless of your distribution because the command works on every Linux distribution including Debian, Ubuntu, Fedora etc:

git clone https://github.com/AdnanHodzic/auto-cpufreq.git
cd auto-cpufreq && sudo ./auto-cpufreq-installer
Installing Auto-CPUFreq On Fedora Linux
Installing AutoCPUFreq On Fedora Linux

Now, press ‘i’ and the enter key to begin installation.

If you are using any Arch Linux-based distribution, then you can also install this tool directly from the AUR:

yay -S auto-cpufreq

Setting up the Auto-CPUFreq Daemon

Once you have installed the application, you can choose to just monitor your system right now, run it either in the Live mode, or you can set it up so that it will run in the background on boot. First, let’s monitor our system.

sudo auto-cpufreq --monitor
Monitor The System Resource Usage Without Enabling The Daemon
Monitor The CPU Usage

Note that it shows me a warning that TLP is configured on my system. If you have TLP installed, then just uninstall it. If you want to try it out in Live mode, then you can do so by typing the following command :

sudo auto-cpufreq --live
Viewing Live Statistics Of AutoCPUFreq
Monitor The CPU Usage

At this step, figure out what is working on your system and if you like the changes this tool applies on your system. As you can see, the AMD CPU core frequency has been reduced to just 404MHz on battery If I plug in the charger, the CPU frequency will automatically scale up to the maximum (overclocked) allowed frequency. You can also disable overclocking in the config file.

If you like the changes, just press Ctrl+C to exit the Interface and then type the following command :

sudo auto-cpufreq --install
To Turn On The Daemon Run The Following Command
To Turn On The Daemon, Run The Following Command

You can also set the CPU frequency scaling manually to Turbo boost mode, Balanced or Powersave on both power supply and while using Battery by modifying the config file which is located in the /etc/auto-cpufreq.conf directory.

Summary

Auto-CPUFreq is a really awesome tool for power management and CPU frequency scaling on Linux based operating systems, specially the automatic configuration of system resources when not in use part amused me. However, this does not mean that this will automatically solve all the Battery life-related issues on Linux. Improvement? Yes, but not a permanent solution.

Let’s see what the future holds for us laptop in the Open source world as the community grows strong. We will have to manage in the meantime with Powertop, Power Profiles Daemon, and TLP GUI to extract more juice out of our battery.

References

Auto-CPUfreq Official GitHub page