2023-03-25 13:21:43 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Tell speedshift whether to maximize CPU performance (100) or energy
|
2023-08-13 01:35:19 +00:00
|
|
|
# efficiency (0). If set to 101 this will enable turboboost.
|
2023-03-25 13:21:43 +00:00
|
|
|
set -euo pipefail
|
|
|
|
IFS=$'\n\t'
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
|
|
|
perc=$1
|
|
|
|
|
2023-10-12 04:50:46 +00:00
|
|
|
if [ "$perc" -gt 100 ]; then
|
2023-08-13 01:35:19 +00:00
|
|
|
echo 0 | tee /sys/devices/system/cpu/intel_pstate/no_turbo
|
|
|
|
else
|
|
|
|
echo 1 | tee /sys/devices/system/cpu/intel_pstate/no_turbo
|
|
|
|
fi
|
|
|
|
|
2023-10-12 04:50:46 +00:00
|
|
|
if [ "$perc" -ge 80 ]; then
|
2023-03-25 13:21:43 +00:00
|
|
|
echo "performance" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
2023-10-12 04:50:46 +00:00
|
|
|
elif [ "$perc" -ge 60 ]; then
|
|
|
|
echo "balance_performance" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
|
|
|
elif [ "$perc" -ge 40 ]; then
|
|
|
|
echo "default" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
|
|
|
elif [ "$perc" -ge 20 ]; then
|
|
|
|
echo "balance_power" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
|
|
|
else
|
|
|
|
echo "power" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
|
2023-03-25 13:21:43 +00:00
|
|
|
fi
|