initial commit. add bin/togglecpu_pstates.sh

main
Luka Prinčič 2022-09-10 23:46:24 +02:00
commit e1a40627b3
1 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,51 @@
#!/usr/bin/env bash
if [[ -z $1 ]]; then
echo "error. no argument."
echo "use [performance|default|power]"
else
if [[ $1 == "performance" ]]
then
for i in /sys/bus/cpu/devices/cpu*
do
CPU=`echo "${i: -1}"`
sudo cpufreq-set -c $CPU -g performance
done
sudo x86_energy_perf_policy --turbo-enable 1
sudo x86_energy_perf_policy -a performance
watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq
elif [[ $1 == "default" ]]
then
for i in /sys/bus/cpu/devices/cpu*
do
CPU=`echo "${i: -1}"`
sudo cpufreq-set -c $CPU -g powersave
done
sudo x86_energy_perf_policy --turbo-enable 0
sudo x86_energy_perf_policy -a default
watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq
elif [[ $1 == "power" ]]
then
for i in /sys/bus/cpu/devices/cpu*
do
CPU=`echo "${i: -1}"`
sudo cpufreq-set -c $CPU -g powersave
done
sudo x86_energy_perf_policy --turbo-enable 0
sudo x86_energy_perf_policy -a power
watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq
else
echo "error. no match."
echo "use [performance|default|power]"
fi
fi