ADD set_hwp

This commit is contained in:
Nathan Dwarshuis 2023-09-29 21:18:28 -04:00
parent c2c246e5e6
commit 335d34921f
1 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,50 @@
#!/bin/sh
# set the HWP preference for all cpus in sysfs
cpus="/sys/devices/system/cpu/cpu*/cpufreq/energy_performance_preference"
usage() {
script=${0##*/}
echo
echo "Invalid usage of ${script}!"
echo
echo "The following options are allowed"
echo
echo "-----------"
echo "$script -1 : default"
echo "$script 0 : power"
echo "$script 1 : balance_power"
echo "$script 2 : balance_performance"
echo "$script 3 : performance"
echo "-----------"
echo
exit 1
}
set_pref() {
for cpu in $cpus; do
echo "$1" > "$cpu"
done
}
case "$1" in
-1)
set_pref "default"
;;
0)
set_pref "power"
;;
1)
set_pref "balance_power"
;;
2)
set_pref "balance_performance"
;;
3)
set_pref "performance"
;;
*)
usage "invalid argument"
esac