Last active
July 6, 2021 03:24
-
-
Save Hermanio/33bd1cdb3df09d91830c24d8163cca96 to your computer and use it in GitHub Desktop.
Quick and dirty early throttling script using bash and intel p-state driver toggling. USE AT YOUR OWN RISK.
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
#!/bin/bash | |
targettemp=90 | |
clockpct=70 | |
while true | |
do | |
currenttemp=$(sensors -u | awk '/temp1_input/ {print $2; exit}' ) | |
compare=$(echo $currenttemp'>'$targettemp | bc -l) | |
turbo=`cat /sys/devices/system/cpu/intel_pstate/no_turbo` | |
if [ "$turbo" -eq 0 ] | |
then | |
if [ "$compare" -eq 1 ] | |
then | |
if [ "$clockpct" -gt 75 ] | |
then | |
let "clockpct-=2" | |
echo $clockpct > /sys/devices/system/cpu/intel_pstate/max_perf_pct | |
fi | |
fi | |
if [ "$compare" -eq 0 ] | |
then | |
if [ "$clockpct" -lt 100 ] | |
then | |
let "clockpct+=1" | |
echo $clockpct > /sys/devices/system/cpu/intel_pstate/max_perf_pct | |
fi | |
fi | |
#echo $clockpct | |
fi | |
sleep 0.5 & wait $! | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment