-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpufreq-setup-PE
executable file
·42 lines (36 loc) · 1011 Bytes
/
cpufreq-setup-PE
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
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check availability :
if [ cpufreq-set ]
then
echo ""
else
echo -e "${RED} [ERROR] cpufreq-set not found. Try installing... ${NC} \n"
echo "`sudo apt install cpufrequtils`"
fi
# Count CPUs :
MAX_CPU=$((`nproc --all` - 1))
CPU_FOUND=$((MAX_CPU + 1))
echo -e "${YELLOW} [INFO] Found ${CPU_FOUND} CPUs.\n"
#
# I discovered that this AMD Ryzen 7840H CPU has a fixed
# frequency at 544Mhz for both Min/Max to be stable.
#
MIN="544Mhz"
MAX="544Mhz"
#
# And the maximum clock of my old lappy, which made me
# feel comfortable was only clocked at 3.2GHz.
#
P_MAX="3200Mhz"
# Set everything in range [400~550] Mhz first &&
# Set 2 first cores as "P-core" within max range :
for i in $(seq 0 $MAX_CPU); do
[[ $i -lt 2 ]] && MAX_OPTION=$P_MAX || MAX_OPTION=$MAX
echo -e "${GREEN} [cpufreq-set]: CPU #" $i " >> [" $MIN "~" $MAX_OPTION "]${NC}";
sudo cpufreq-set -c $i --min $MIN --max $MAX_OPTION;
done