summaryrefslogtreecommitdiff
path: root/libre/linux-libre-tools/cpupower.systemd
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-08-08 09:16:29 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-08-08 09:16:29 -0300
commit91b1c319d6364307eb3bfcb0768e3eaa09df7c17 (patch)
tree91a5fcd8f433130db7dfc8060b66f98103949797 /libre/linux-libre-tools/cpupower.systemd
parent0c2419984cf5501fc1ba410e09f61fa4112c7d2a (diff)
parent9bb78d53ceba7b16ef8374b20c4ed662e34b789c (diff)
downloadabslibre-91b1c319d6364307eb3bfcb0768e3eaa09df7c17.tar.gz
abslibre-91b1c319d6364307eb3bfcb0768e3eaa09df7c17.tar.bz2
abslibre-91b1c319d6364307eb3bfcb0768e3eaa09df7c17.zip
Merge branch 'master' of ssh://gparabola/srv/git/abslibre
Conflicts: libre/kdelibs-libre/PKGBUILD
Diffstat (limited to 'libre/linux-libre-tools/cpupower.systemd')
-rw-r--r--libre/linux-libre-tools/cpupower.systemd32
1 files changed, 32 insertions, 0 deletions
diff --git a/libre/linux-libre-tools/cpupower.systemd b/libre/linux-libre-tools/cpupower.systemd
new file mode 100644
index 000000000..f45b02bc8
--- /dev/null
+++ b/libre/linux-libre-tools/cpupower.systemd
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+. /etc/conf.d/cpupower
+
+declare -i fail=0
+
+# parse frequency options
+declare -a params=()
+params+=(${governor:+-g $governor})
+params+=(${min_freq:+-d $min_freq})
+params+=(${max_freq:+-u $max_freq})
+params+=(${freq:+-f $freq})
+
+# apply frequency options
+if ((${#params[@]} > 0)); then
+ cpupower frequency-set "${params[@]}" >/dev/null || fail=1
+fi
+
+# parse cpu options
+declare -a params=()
+params+=(${mc_scheduler:+-m $mc_scheduler})
+params+=(${smp_scheduler:+-s $smp_scheduler})
+params+=(${perf_bias:+-b $perf_bias})
+
+# apply cpu options
+if ((${#params[@]} > 0)); then
+ cpupower set "${params[@]}" >/dev/null || fail=1
+fi
+
+exit $fail
+
+# vim:set ts=2 sw=2 ft=sh et: