-
Notifications
You must be signed in to change notification settings - Fork 0
/
config
executable file
·71 lines (63 loc) · 1.56 KB
/
config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Call without arguments to produce the ordinary config file, or with a number
# of cores to produce a config file for debugging.
echo "# Throttle configuration file"
# System configuration
echo "# System configuration"
if [ $# -ge 1 ]; then
CORES=$1
else
CORES=$(nproc)
fi
echo "cores =" $CORES
# Where do we get the temperature?
if [ $# -ge 1 ]; then
echo "temp_file = temp_input"
touch temp_input
echo "60000" > temp_input
else
# Try to find the temperature file
TEMP_FILE=null
for i in $(seq 0 3); do
for j in $(seq 0 3); do
file="/sys/class/hwmon/hwmon$i/device/temp${j}_input"
if [ -f $file ]; then
TEMP_FILE=$file
break;
fi
file="/sys/class/hwmon/hwmon$i/temp${j}_input"
if [ -f $file ]; then
TEMP_FILE=$file
break;
fi
done
file="/sys/class/thermal/thermal_zone$i/temp"
if [ -f $file ]; then
TEMP_FILE=$file
break;
fi
done
echo "temp_file = $TEMP_FILE"
fi
# Creating a list of availabe frequencies
echo -n "freq_list = "
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
# Where do we write the target maximum temperature?
if [ $# -ge 1 ]; then
echo "freq_set_prefix = cpu"
echo "freq_set_suffix = freq"
MAXCORE=$((CORES - 1))
for i in $(seq 0 $MAXCORE); do
touch cpu${i}freq
cat /sys/devices/system/cpu/cpu${i}/cpufreq/scaling_max_freq > cpu${i}freq
done
else
echo "freq_set_prefix = /sys/devices/system/cpu/cpu"
echo "freq_set_suffix = /cpufreq/scaling_max_freq"
fi
echo ""
# Write default settings
echo "# Settings"
echo "temp_min = 60"
echo "temp_max = 80"
echo "wait = 5"