aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarco44 <cousinmarc@gmail.com>2018-10-06 15:06:08 +0200
committermarco44 <cousinmarc@gmail.com>2018-10-06 15:06:08 +0200
commitfe04105060d52215dae8c6dc48dfc4a72fbf9414 (patch)
tree7922717065ecba045f4f99e07cc468ee1a5e3e67
parent4199e7ec107d50e5fcdbf1d4a012174d8913835b (diff)
downloadtemp-throttle-fe04105060d52215dae8c6dc48dfc4a72fbf9414.tar.gz
Small improvements:
- Sort the frequencies in decreasing order (it's not the case on arm for instance) - Monitor the temperature from all sources instead of only one entry. That's safer if only one core (or gpu) gets very hot
-rwxr-xr-xtemp_throttle.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/temp_throttle.sh b/temp_throttle.sh
index 8d4f7d1..be0209f 100755
--- a/temp_throttle.sh
+++ b/temp_throttle.sh
@@ -56,7 +56,7 @@ FREQ_MAX="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
# Store available cpu frequencies in a space separated string FREQ_LIST.
if [ -f $FREQ_FILE ]; then
# If $FREQ_FILE exists, get frequencies from it.
- FREQ_LIST=$(cat $FREQ_FILE) || err_exit "Could not read available cpu frequencies from file $FREQ_FILE"
+ FREQ_LIST=$(cat $FREQ_FILE | xargs -n1 | sort -g -r | xargs) || err_exit "Could not read available cpu frequencies from file $FREQ_FILE"
elif [ -f $FREQ_MIN -a -f $FREQ_MAX ]; then
# Else if $FREQ_MIN and $FREQ_MAX exist, generate a list of frequencies between them.
FREQ_LIST=$(seq $(cat $FREQ_MAX) -100000 $(cat $FREQ_MIN)) || err_exit "Could not compute available cpu frequencies"
@@ -132,9 +132,9 @@ unthrottle () {
}
get_temp () {
- # Get the system temperature.
+ # Get the system temperature. Take the max of all counters
- TEMP=$(cat $TEMP_FILE)
+ TEMP=$(cat $TEMPERATURE_FILES 2>/dev/null | xargs -n1 | sort -g -r | head -1)
}
### END define script functions.