add cpuctl
This commit is contained in:
31
bin/cpuctl
Executable file
31
bin/cpuctl
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
MIN_FREQUENCY=$(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq)
|
||||
MAX_FREQUENCY=$(cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq)
|
||||
SCALING_MAX=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq)
|
||||
SCALING_MIN=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq)
|
||||
GOVERNOR=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor)
|
||||
|
||||
if [ "$1" = "get" ]; then
|
||||
echo "Minimum / Maximum Frequencies: $SCALING_MIN / $SCALING_MAX"
|
||||
echo "Governor: $GOVERNOR"
|
||||
elif [ "$1" = "set" ]; then
|
||||
case "$2" in
|
||||
"")
|
||||
echo "Set what? Nothing was changed, exiting...";;
|
||||
"defaults")
|
||||
echo "$MIN_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_min_freq
|
||||
echo "$MAX_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_max_freq;;
|
||||
"minfreq")
|
||||
echo "$MIN_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_max_freq
|
||||
echo "$MIN_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_min_freq;;
|
||||
"maxfreq")
|
||||
echo "$MAX_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_min_freq
|
||||
echo "$MAX_FREQUENCY" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_max_freq;;
|
||||
"ondemand")
|
||||
echo "ondemand" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor;;
|
||||
"schedutil")
|
||||
echo "schedutil" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor;;
|
||||
"performance")
|
||||
echo "performance" | sudo tee /sys/devices/system/cpu/cpufreq/policy*/scaling_governor;;
|
||||
esac
|
||||
fi
|
||||
Reference in New Issue
Block a user