initial commit. add bin/togglecpu_pstates.sh
commit
e1a40627b3
|
@ -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
|
Loading…
Reference in New Issue