-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpbp-cpu.sh
executable file
·68 lines (60 loc) · 2.32 KB
/
pbp-cpu.sh
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
#!/bin/bash
# Script by Syonyk: https://syonyk.blogspot.com/
# Do what you wish with it. Patches welcome at:
# https://github.com/syonyk/pinebookpro
if [ $# -eq 0 ]; then
echo "Usage: sudo pbp_cpu.sh [all, big, little, status, gov [governor]]"
exit
fi
if [ $1 = "all" ]; then
echo "Enabling all cores."
echo 1 > /sys/devices/system/cpu/cpu0/online
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo 1 > /sys/devices/system/cpu/cpu4/online
echo 1 > /sys/devices/system/cpu/cpu5/online
fi
if [ $1 = "big" ]; then
echo "Enabling only big cores."
# Online the big cores first, then take the little ones offline.
echo 1 > /sys/devices/system/cpu/cpu4/online
echo 1 > /sys/devices/system/cpu/cpu5/online
echo 0 > /sys/devices/system/cpu/cpu0/online
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 0 > /sys/devices/system/cpu/cpu2/online
echo 0 > /sys/devices/system/cpu/cpu3/online
fi
if [ $1 = "little" ]; then
echo "Enabling only LITTLE cores."
echo 1 > /sys/devices/system/cpu/cpu0/online
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo 0 > /sys/devices/system/cpu/cpu4/online
echo 0 > /sys/devices/system/cpu/cpu5/online
fi
if [ $1 = "status" ]; then
echo "Core status:";
echo -n "cpu0 (LITTLE): "
cat /sys/devices/system/cpu/cpu0/online
echo -n "cpu1 (LITTLE): "
cat /sys/devices/system/cpu/cpu1/online
echo -n "cpu2 (LITTLE): "
cat /sys/devices/system/cpu/cpu2/online
echo -n "cpu3 (LITTLE): "
cat /sys/devices/system/cpu/cpu3/online
echo -n "cpu4 (big) : "
cat /sys/devices/system/cpu/cpu4/online
echo -n "cpu5 (big) : "
cat /sys/devices/system/cpu/cpu5/online
fi
if [ $1 = "gov" ]; then
echo "Setting governor ${2}"
echo $2 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $2 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo $2 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo $2 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo $2 > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor
echo $2 > /sys/devices/system/cpu/cpu5/cpufreq/scaling_governor
fi