Skip to content

Instantly share code, notes, and snippets.

@isilence
Last active May 13, 2019 16:29
Show Gist options
  • Save isilence/48228ab12a9b31a6acf79d721fec75d1 to your computer and use it in GitHub Desktop.
Save isilence/48228ab12a9b31a6acf79d721fec75d1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ "s$1" == "smax" ]; then
noturbo=0
online=1
governor=performance
preference=performance
elif [ "s$1" == "smin" ]; then
noturbo=1
online=0
governor=powersave
preference=power
else
noturbo=1
online=1
governor=powersave
preference=default
fi
echo -n "$noturbo" > /sys/devices/system/cpu/intel_pstate/no_turbo
for i in $(seq 4 7); do
echo "$online" > "/sys/devices/system/cpu/cpu$i/online"
done
for f in `find /sys/devices/system/cpu/ -maxdepth 1 -regex ".*/cpu[0-9]+"` ; do
echo "$governor" > "$f/cpufreq/scaling_governor"
echo "$preference" > "$f/cpufreq/energy_performance_preference"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment