Created
February 3, 2011 16:55
-
-
Save sleepynate/809769 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Set cpu scaling policy the convenient way. | |
# | |
# nathan (period) dotz (at) gmail (period) com | |
# | |
max_cpu() { | |
echo performance | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | |
echo performance | sudo tee /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor | |
} | |
norm_cpu() { | |
echo ondemand | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | |
echo ondemand | sudo tee /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor | |
} | |
help() { | |
<< EOF | |
usage: cpuspeed [OPTION] | |
OPTIONS: | |
-m|--max Set cpureq to "performance". | |
-n|--norm Set cpureq to "ondemand". | |
-h|--help Show this help message. | |
EOF | |
} | |
case "$1" in | |
'-m'|'--max') | |
max_cpu | |
;; | |
'-n'|'--norm') | |
norm_cpu | |
;; | |
'-h'|'--help'|*) help | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment