Compare commits

...

5 Commits

Author SHA1 Message Date
Sepero 4e6fa06ea0
Additional Arm support 2019-01-09 20:16:09 -05:00
Sepero 82517aae63
Merge pull request #34 from marco44/marco44_improvements
Small improvements:
2019-01-09 20:10:00 -05:00
marco44 fe04105060 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
2018-10-06 15:06:08 +02:00
Sepero 4199e7ec10 Reset temperature on start 2015-10-25 09:43:11 -04:00
Sepero 44662b3fb7 Misc typo corrections 2015-10-25 08:32:47 -04:00
2 changed files with 12 additions and 9 deletions

View File

@ -1,3 +1,3 @@
GNU GPL 2.0
http://www.gnu.org/licenses/gpl-2.0.html
Sepero 2012-2013
Sepero 2012-2016

View File

@ -2,10 +2,10 @@
# Usage: temp_throttle.sh max_temp
# USE CELSIUS TEMPERATURES.
# version 2.20
# version 2.21
cat << EOF
Author: Sepero 2013 (sepero 111 @ gmx . com)
Author: Sepero 2016 (sepero 111 @ gmx . com)
URL: http://github.com/Sepero/temp-throttle/
EOF
@ -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,21 +132,24 @@ 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.
echo "Initialize to max CPU frequency"
unthrottle
# Mainloop
# Main loop
while true; do
get_temp # Gets the current tempurature and set it to the variable TEMP.
get_temp # Gets the current temperature and set it to the variable TEMP.
if [ $TEMP -gt $MAX_TEMP ]; then # Throttle if too hot.
throttle
elif [ $TEMP -le $LOW_TEMP ]; then # Unthrottle if cool.
unthrottle
fi
sleep 3 # The amount of time between checking tempuratures.
sleep 3 # The amount of time between checking temperatures.
done