Add cpu_set_perf_perc on Linux.

This commit is contained in:
Tom Alexander 2023-03-25 09:21:43 -04:00
parent 347ffaea12
commit f1da60377e
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
#
# Tell speedshift whether to maximize CPU performance (100) or energy
# efficiency (0).
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
perc=$1
if [ $perc -lt 50 ]; then
echo "power" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
else
echo "performance" | tee /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference
fi

View File

@ -65,7 +65,7 @@
owner: root
group: wheel
loop:
- src: cpu_set_perf_perc
- src: cpu_set_perf_perc_freebsd
dest: /usr/local/bin/cpu_set_perf_perc
- name: Install loader.conf

View File

@ -25,3 +25,15 @@
loop:
- src: energy_performance_preference.conf
dest: /etc/tmpfiles.d/energy_performance_preference.conf
- name: Install scripts
when: hwpstate is defined and hwpstate
copy:
src: "files/{{ item.src }}"
dest: "{{ item.dest }}"
mode: 0755
owner: root
group: wheel
loop:
- src: cpu_set_perf_perc_linux
dest: /usr/local/bin/cpu_set_perf_perc