Skip to content

Commit

Permalink
small fix and verbose mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1t3h47 committed May 31, 2021
1 parent 232c42d commit d37cca1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ freq=1000
min_freq=false
disable_turbo=1
governor=false
debug=false

while getopts "h?m:j:c:d:t" opt; do
while getopts "h?m:j:c:d:tv" opt; do
case "$opt" in
h|\?)
show_help
Expand Down Expand Up @@ -78,6 +79,9 @@ while getopts "h?m:j:c:d:t" opt; do
g)
governor=${OPTARG}
;;
v)
debug=true
;;
*)
# Ideally will not run as getopt handles it
invalid_argument "${0} -${opt}"
Expand Down Expand Up @@ -112,7 +116,7 @@ cpu_end=$((${nprocessors_conf} - 1))
# min_cpu_freq=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
max_cpu_freq=`lscpu | grep -Po 'CPU max MHz:\s*\K[0-9]+' | sed "s/\.//g"`
min_cpu_freq=`lscpu | grep -Po 'CPU min MHz:\s*\K[0-9]+' | sed "s/\.//g"`
echo "min cpu $min_cpu_freq"
# echo "min cpu $min_cpu_freq"
specified_freq=${freq}

function invalid_frequency() {
Expand Down Expand Up @@ -184,15 +188,15 @@ do
governor='performance'
fi

# echo "cpufreq-set -r --cpu ${cpu} --governor ${governor} -d ${min_freq}MHz -u ${ac_max}MHz"
if [ $debug == true ]; then echo "cpufreq-set -r --cpu ${cpu} --governor ${governor} -d ${min_freq}MHz -u ${ac_max}MHz"; fi
cpufreq-set -r --cpu ${cpu} --governor ${governor} -d ${min_freq}MHz -u ${ac_max}MHz
else
if [ $governor == false ]; then
governor='powersave'
fi

# echo "cpufreq-set -r --cpu ${cpu} --governor $governor -d ${min_freq}MHz -u ${freq}"
cpufreq-set -r --cpu ${cpu} --governor $governor -d ${min_freq}MHz -u ${freq}MHz
if [ $debug == true ]; then echo "cpufreq-set -r --cpu ${cpu} --governor $governor -d ${min_freq}MHz -u ${freq}"; fi
cpufreq-set -r --cpu ${cpu} --governor $governor -d ${min_freq}MHz -u ${freq}
fi
# echo 1000000 > /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_max_freq
# echo 1000000 > /sys/devices/system/cpu/cpu${i}/cpufreq/cpuinfo_max_freq
Expand Down

0 comments on commit d37cca1

Please sign in to comment.