Add support for controlling turbo boost in the set cpu perf perc script.

This commit is contained in:
Tom Alexander 2023-08-12 21:35:19 -04:00
parent 40437bec04
commit e84fd15cf2
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -1,13 +1,20 @@
#!/usr/bin/env bash
#
# Tell speedshift whether to maximize CPU performance (100) or energy
# efficiency (0).
# efficiency (0). If set to 101 this will enable turboboost.
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
perc=$1
if [ $perc -gt 100 ]; then
echo 0 | tee /sys/devices/system/cpu/intel_pstate/no_turbo
perc=100
else
echo 1 | tee /sys/devices/system/cpu/intel_pstate/no_turbo
fi
if [ $perc -lt 50 ]; then
echo "power" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
else