summaryrefslogtreecommitdiff
path: root/community/linux-tools
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2012-08-24 12:49:28 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2012-08-24 12:49:28 -0300
commit0c5c6934b681707ec1a459da4318aabd7f9b796f (patch)
tree7ad632e8f99be5f959a9208726944302eb702e76 /community/linux-tools
parent1e612047394eb4eee29357e7ab156db60b88f783 (diff)
parent12b846e1ead204137d60caba25f7e494b51b4dc8 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community/linux-tools/PKGBUILD community/powertop/PKGBUILD
Diffstat (limited to 'community/linux-tools')
-rw-r--r--community/linux-tools/cpupower.pmutils37
1 files changed, 37 insertions, 0 deletions
diff --git a/community/linux-tools/cpupower.pmutils b/community/linux-tools/cpupower.pmutils
new file mode 100644
index 000000000..fb93cd7c1
--- /dev/null
+++ b/community/linux-tools/cpupower.pmutils
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+[[ -x /usr/bin/cpupower ]] || exit $NA
+
+CPUPOWER_GOVERNOR_AC=${CPUPOWER_GOVERNOR_AC:-ondemand}
+CPUPOWER_GOVERNOR_BAT=${CPUPOWER_GOVERNOR_BAT:-conservative}
+
+help() {
+ cat <<EOF
+--------
+$0: Select cpupower frequency governor.
+
+Parameters:
+CPUPOWER_GOVERNOR_AC = Governor to use on AC.
+Defaults to ondemand.
+
+CPUPOWER_GOVERNOR_BAT = Governor to use on battery.
+Defaults to conservative.
+
+EOF
+}
+
+cpupow() {
+ printf 'Setting cpupower frequency governor to %s...' "$1"
+ cpupower -c all frequency-set -g "$1"
+}
+
+case $1 in
+ true) cpupow "$CPUPOWER_GOVERNOR_BAT" ;;
+ false) cpupow "$CPUPOWER_GOVERNOR_AC" ;;
+ help) help;;
+ *) exit $NA ;;
+esac
+
+exit 0
+
+# vim:set ts=2 sw=2 ft=sh et: