p
sT
n
iux
Li
Useful Tips for GNU/Linux Operating System
Blog Archive
2011 (5)
CPe
Fq
U
rn
ug
eiS
nca
yl
June (1)
May (1)
I have written a small shell script to increase or decrease CPU frequency. By default, it shows current CPU
Frequency Scaling Governor. This can be changed only by root user. So this script needs to be run as root
user or sudo as root, while changing the CPU Frequency Scaling governor.
#!/bin/bash
About Me
mitesh.singh.jat
available_governors=$(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
\
| head -1 | sed -e 's/ \([a-zA-Z0-9]\)/|\1/g' -e 's/ $//')
if [ $# -ne 1 ]
then
echo "USAGE: $0 [$available_governors]"
fi
Sample Run
Getting current CPU Frequency Scaling Governor
$ cd /path/where/cpu_scaling.sh/is/copied/
converted by Web2PDFConvert.com
$ ./cpu_scaling.sh
USAGE: ./cpu_scaling.sh [powersave|conservative|ondemand|userspace|performance]
Command line to change CPU Scaling.
- By Mitesh Singh Jat
Current CPU Scaling Governor is: ondemand
Increasing CPU frequency (Please run as root).
$ ./cpu_scaling.sh performance
Command line to change CPU Scaling.
- By Mitesh Singh Jat
Current CPU Scaling Governor is: ondemand
./cpu_scaling.sh: please run this script as root user.
$ sudo ./cpu_scaling.sh performance
[sudo] password for mitesh:
Command line to change CPU Scaling.
- By Mitesh Singh Jat
Current CPU Scaling Governor is: ondemand
Setting CPU into Performance Mode...
Current CPU Scaling Governor is: performance
$ ./cpu_scaling.sh
USAGE: ./cpu_scaling.sh [powersave|conservative|ondemand|userspace|performance]
Command line to change CPU Scaling.
- By Mitesh Singh Jat
Current CPU Scaling Governor is: performance
Decreasing CPU frequency
$ sudo ./cpu_scaling.sh ondemand
Command line to change CPU Scaling.
- By Mitesh Singh Jat
Current CPU Scaling Governor is: performance
Setting CPU into OnDemand Mode...
Current CPU Scaling Governor is: ondemand
0 comments:
Post a Comment
Newer
Post
Home
Older
Post
converted by Web2PDFConvert.com