summaryrefslogtreecommitdiff
path: root/libre/linux-libre-tools/cpupower.systemd
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2014-02-18 01:56:34 +0000
committerNicolás Reynolds <fauno@endefensadelsl.org>2014-02-18 01:56:34 +0000
commit8185891e28635bdb83fdf4ba4391030912dae596 (patch)
tree66a946535bdd228514750233b2cc99dd1866ff64 /libre/linux-libre-tools/cpupower.systemd
parent60a11f87366fdfbd114cdc91ff813518858e5f8d (diff)
Tue Feb 18 01:56:27 UTC 2014
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..51c645415
--- /dev/null
+++ b/libre/linux-libre-tools/cpupower.systemd
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+. /etc/default/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: