simdjson/scripts/setupfortesting/powerpolicy.sh

33 lines
826 B
Bash
Raw Normal View History

2019-01-04 04:24:49 +08:00
#!/usr/bin/env bash
2019-04-06 06:20:21 +08:00
# sudo /usr/bin/cpupower frequency-set -g performance
#######
2019-01-04 04:24:49 +08:00
# taken from http://hbfs.wordpress.com/2013/06/18/fast-path-finding-part-ii/
# might require sudo apt-get install cpufrequtils
2020-11-04 04:48:09 +08:00
# invoke with performance or ondemand
2019-01-04 04:24:49 +08:00
# type cpufreq-info to check results, you can also verify with cat /proc/cpuinfo
# enumerate found CPUs
cpus=$( grep processor /proc/cpuinfo | cut -d: -f 2 )
if [ "$1" = "ondemand" ]; then
echo "setting up ondemand"
policy="ondemand"
elif [ "$1" = "performance" ]; then
echo "setting up for performance"
policy="performance"
elif [ "$1" = "list" ]; then
cpufreq-info
exit 0
else
echo "usage: powerpolicy.sh ondemand | performance list"
exit -1
fi
2020-11-04 04:48:09 +08:00
echo "chosen policy " $1
2019-01-04 04:24:49 +08:00
# set governor for each CPU
#
for cpu in ${cpus[@]}
do
cpufreq-set -c $cpu -g $1
done