cpupower.systemd 743 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. # Copyright © 2012, Sébastien Luttringer
  3. # SPDX-License-Identifier: GPL-2.0-or-later
  4. declare -i fail=0
  5. # parse frequency options
  6. declare -a params=()
  7. params+=(${governor:+-g $governor})
  8. params+=(${min_freq:+-d $min_freq})
  9. params+=(${max_freq:+-u $max_freq})
  10. params+=(${freq:+-f $freq})
  11. # apply frequency options
  12. if ((${#params[@]} > 0)); then
  13. cpupower frequency-set "${params[@]}" >/dev/null || fail=1
  14. fi
  15. # parse cpu options
  16. declare -a params=()
  17. params+=(${mc_scheduler:+-m $mc_scheduler})
  18. params+=(${smp_scheduler:+-s $smp_scheduler})
  19. params+=(${perf_bias:+-b $perf_bias})
  20. # apply cpu options
  21. if ((${#params[@]} > 0)); then
  22. cpupower set "${params[@]}" >/dev/null || fail=1
  23. fi
  24. exit $fail
  25. # vim:set ts=2 sw=2 ft=sh et: