Home | About me | Miniblog | Playground
Español | Italiano
Published January 16, 2023

sacf - simple auto cpu frequencer

About

On my daily linux usage, I soon stumble upon auto-cpufreq. Werks really nice. sacf is just a simpler rewrite more or less. Some other reasons that motivate me:

I thought that the python script was doing some ’black magick’ but it was quite simple when I focused on the logic behind it.

The author of auto-cpufreq left such great blog post with even a youtube video to showcase auto-cpufreq. Really encorage you to take a look.

I still think autocpu-freq --monitor output is very nice, since it gives a per core usage, so in general feel free to test both programs.

Why should I use this?

For a dynamic turbo boost switcher, depending on the overall usage. Also a automatic governor switcher based on AC adapter status (using battery or no).

Otherwise, tlp should be more than enough for you battery power savings, disables most things by default like blueetooth and wifi at boot. It is dynamic: in fact it is event based.

Logic

Without arguments sacf will run forever (foreground), however a cli flag -r is implemented to run once. This flag is very useful if instead of having a program run forever, you could set a cronjob or manually call sacf.

The ’auto-cpufreq’ part is doing some actions, that enhanced or reduces battery, based on certain conditions.

Actions:

Conditions:

Moreover, we add the event of detecting an AC source power. Based on that state the kernel govenor changes respectively: using battery → power save govenor and connected to power source → performance govenor.

Monitor mode

To simulate something like autocpu-freq --monitor you can use the -l cli flag with watch.

    $ watch -n1 sacf -l

You can use that command with stress an watch how sacf handles changes regarding system load.

This work is licensed under CC-BY-SA 2.0, unless specified otherwise. Year: 2022