Skip to content

Instantly share code, notes, and snippets.

@sleepynate
Created February 3, 2011 16:55
Show Gist options
  • Save sleepynate/809769 to your computer and use it in GitHub Desktop.
Save sleepynate/809769 to your computer and use it in GitHub Desktop.
#!/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