forked from konkor/cpufreq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpufreqctl
More file actions
executable file
·119 lines (115 loc) · 2.33 KB
/
cpufreqctl
File metadata and controls
executable file
·119 lines (115 loc) · 2.33 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
cpucount=`cat /proc/cpuinfo|grep processor|wc -l`
FLROOT=/sys/devices/system/cpu
if [ $# -lt 1 ]
then
echo "Usage: cpufreqctl.sh [gov|list|driver|info|freq|set|turbo|min|max|boost] [value]"
echo "current driver"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
echo "available governors"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
echo "current cpu0 governor"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
exit
fi
if [ $1 = "gov" ]
then
if [ $# = 1 ]
then
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
exit
fi
i=0
while [ $i -ne $cpucount ]
do
FLNM="$FLROOT/cpu"$i"/cpufreq/scaling_governor"
echo "Setting $FLNM to " $2
echo $2 > $FLNM
i=`expr $i + 1`
done
exit
fi
if [ $1 = "list" ]
then
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
exit
fi
if [ $1 = "driver" ]
then
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver
exit
fi
if [ $1 = "info" ]
then
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
exit
fi
if [ $1 = "freq" ]
then
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
exit
fi
if [ $1 = "set" ]
then
if [ $# = 1 ]
then
echo "available frequences"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
echo "current cpu frequence"
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
exit
fi
i=0
while [ $i -ne $cpucount ]
do
FLNM="$FLROOT/cpu"$i"/cpufreq/scaling_setspeed"
echo "Setting $FLNM to " $2
echo $2 > $FLNM
i=`expr $i + 1`
done
exit
fi
if [ $1 = "turbo" ]
then
if [ $# = 1 ]
then
cat /sys/devices/system/cpu/intel_pstate/no_turbo
exit
fi
echo "Setting TURBO to " $2
echo $2 > /sys/devices/system/cpu/intel_pstate/no_turbo
exit
fi
if [ $1 = "min" ]
then
if [ $# = 1 ]
then
cat /sys/devices/system/cpu/intel_pstate/min_perf_pct
exit
fi
echo "Setting MIN to " $2
echo $2 > /sys/devices/system/cpu/intel_pstate/min_perf_pct
exit
fi
if [ $1 = "max" ]
then
if [ $# = 1 ]
then
cat /sys/devices/system/cpu/intel_pstate/max_perf_pct
exit
fi
echo "Setting MAX to " $2
echo $2 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
exit
fi
if [ $1 = "boost" ]
then
if [ $# = 1 ]
then
cat /sys/devices/system/cpu/cpufreq/boost
exit
fi
echo "Setting BOOST to " $2
echo $2 > /sys/devices/system/cpu/cpufreq/boost
exit
fi