summaryrefslogblamecommitdiffstats
path: root/sbin/set_governor
blob: 08f68e502001a974547eadd2e92c736fa3c8153a (plain) (tree)




































                                                                                                                                    
#!/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