summaryrefslogtreecommitdiffstats
path: root/sbin/set_governor
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/set_governor')
-rwxr-xr-xsbin/set_governor37
1 files changed, 37 insertions, 0 deletions
diff --git a/sbin/set_governor b/sbin/set_governor
new file mode 100755
index 0000000..08f68e5
--- /dev/null
+++ b/sbin/set_governor
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# Script to display and set (checked) the governors for the both CPU Cores (f.e. from the Core2Duo)
+# (c) Alexander Sulfrian 2007
+# Licence: GPL v3
+#
+
+
+if [ -z "$1" ]
+then
+ activ_governor_cpu0=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
+ activ_governor_cpu1=`cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor`
+ echo "active governors"
+ echo "CPU 0: ${activ_governor_cpu0}"
+ echo "CPU 1: ${activ_governor_cpu1}"
+ exit 1
+fi
+
+
+governor_avalible=`sed 's/ \(.\)/\n\1/g;s/ $//g' /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | grep "^${1}\$"`
+if [ -z "$governor_avalible" ]
+then
+ avalible_governors=`sed 's/ \(.\)/|\1/g;s/ $//g' /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors`
+ echo "Usage:"
+ echo "$0 [${avalible_governors}]"
+ exit 2
+fi
+
+echo "$1" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
+echo "$1" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
+
+activ_governor_cpu0=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
+activ_governor_cpu1=`cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor`
+echo "active governors"
+echo "CPU 0: ${activ_governor_cpu0}"
+echo "CPU 1: ${activ_governor_cpu1}"
+exit 0