Open HadiModarres opened 5 years ago
I'm not an expert, but on the documentation there are few considerations about that:
By default, Clear Linux OS prioritizes maximum CPU performance with the philosophy that the faster the program finishes execution, the faster the CPU can return to a low energy idle state.
Clear Linux OS sets the CPU governor to performance which calls for the CPU to operate at maximum clock frequency. In other words, P-state P0. While this may sound wasteful at first, it is important to remember that power utilization does not increase significantly simply because of a locked clock frequency without a workload.
@MattiaVerticchio Well for the first argument, that philosophy is obviously flawed, because like the use case I mentioned (watching videos) the program never finishes.
and also for the second one it does in fact increase power utilization significantly.
I understand your points, and I'd like to know the opinions of the developers on that.
Also, automatic switching to powersave
has already been mentioned in a previous issue.
I've been using clear linux for a week on my laptop and I'm amazed how good it is. I have a suggestion that could improve it further. Currently when I watch a video in my browser if I set scaling governor to powersave, powertop shows around 7.5 Watts energy consumption. If I change the governor back to performance(which is the default in clear linux) consumption steadies at around 11.5 Watts. This makes battery drained a lot faster when watching something on battery.
So my suggestion is to: automatically set governor to powersave when on battery and set to performance on AC
How do you do that in CL? I tried installing auto-cpufreq application, but wasn't successful.
I installed auto-cpufreq using nix. There is an issue when installing to clear linux, to resolve it use sudo mkdir /etc/tmpfiles.d
and then run the installer.
clear linux nowadays checks the system type and uses "performance" for servers and high end desktop, but more power friendly governors for laptops and things with batteries...
On Fri, Nov 3, 2023 at 4:19 PM Oliver Sargison @.***> wrote:
I installed auto-cpufreq using nix https://nixos.org/download. There is an issue when installing to clear linux, to resolve it use sudo mkdir /etc/tmpfiles.d and then run the installer.
— Reply to this email directly, view it on GitHub https://github.com/clearlinux/distribution/issues/978#issuecomment-1793231646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ54FKXMBWYEJE3HLORETTYCV3WLAVCNFSM4H5NRYCKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZZGMZDGMJWGQ3A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
With this shell script, I was able to have my laptop automatically change between performance and powersave modes when on battery:
#!/bin/sh
# Switch CPU governor to performance when on AC power
mkdir /usr/local/bin
tee /usr/local/bin/set-perf-mode.sh << 'EOF'
#!/bin/sh
if [ "$1" = true ]; then
echo "/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor performance" | tee /etc/clr-power-tweaks.conf
elif [ "$1" = false ]; then
echo "/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor powersave" | tee /etc/clr-power-tweaks.conf
else
rm -f /etc/clr-power-tweaks.conf
fi
clr_power
EOF
chmod +x /usr/local/bin/set-perf-mode.sh
mkdir /etc/udev/rules.d
tee /etc/udev/rules.d/power.rules << 'EOF'
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/local/bin/set-perf-mode.sh false"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/local/bin/set-perf-mode.sh true"
EOF
tee /etc/rc.local << 'EOF'
#!/bin/sh -e
#
# rc.local - executed at the end of each multiuser runlevel
#
# Make sure that the script will "exit 0" on success or any other
# value on error.
udevadm trigger -s power_supply
exit 0
EOF
udevadm control --reload-rules
udevadm trigger -s power_supply
I've been using clear linux for a week on my laptop and I'm amazed how good it is. I have a suggestion that could improve it further. Currently when I watch a video in my browser if I set scaling governor to powersave, powertop shows around 7.5 Watts energy consumption. If I change the governor back to performance(which is the default in clear linux) consumption steadies at around 11.5 Watts. This makes battery drained a lot faster when watching something on battery.
So my suggestion is to: automatically set governor to powersave when on battery and set to performance on AC