summaryrefslogtreecommitdiff
path: root/libre/linux-libre-tools/cpupower.systemd
blob: 51c6454152638bf9ab9d931f9c1aef5f3cffb328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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: