Created
July 29, 2021 13:53
-
-
Save sunsided/c32e1f33217bce793fc53c9ac4e4391d to your computer and use it in GitHub Desktop.
CPU governor selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eo pipefail | |
GOVERNORS=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors) | |
echo "Available governors:" | |
echo $GOVERNORS | |
echo "" | |
echo "Current governor:" | |
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | |
# Options: powersave, performance | |
CPU=$1 | |
if [[ " $GOVERNORS " =~ .*\ $CPU\ .* ]]; then | |
echo "" | |
echo "Selecting '$CPU' CPU governor." | |
echo $CPU | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment