-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcpuGovernor.sh
More file actions
47 lines (39 loc) · 1.06 KB
/
cpuGovernor.sh
File metadata and controls
47 lines (39 loc) · 1.06 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
#! /usr/bin/env bash
# Function to show current CPU scaling governor
show_current_governor() {
echo "Current CPU Scaling Governor(s):"
for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
do
echo -n "$(basename $(dirname $cpu)) : "
cat $cpu
done
}
# Function to change the CPU scaling governor
change_governor() {
echo "Available governors: performance powersave ondemand userspace conservative"
read -p "Enter the desired governor: " governor
for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
do
echo $governor > $cpu
done
echo "CPU Scaling Governor changed to $governor."
show_current_governor
}
# Main menu
echo "CPU Scaling Governor Management"
echo "1. Show current CPU Scaling Governor"
echo "2. Change CPU Scaling Governor"
read -p "Please choose an option (1 or 2): " option
case $option in
1)
show_current_governor
;;
2)
change_governor
;;
*)
echo "Invalid option selected. Exiting."
exit 1
;;
esac
exit 0