From 6a99bb2571732dbd860485dcca662b03f86d3780 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Mon, 19 Oct 2020 21:24:14 +0100 Subject: [PATCH] bin: add cpu_performance/cpu_powersave helpers to set cpu scaling_governor Signed-off-by: Alejandro Mery --- files/bin/cpu_performance | 12 ++++++++++++ files/bin/cpu_powersave | 1 + 2 files changed, 13 insertions(+) create mode 100755 files/bin/cpu_performance create mode 120000 files/bin/cpu_powersave diff --git a/files/bin/cpu_performance b/files/bin/cpu_performance new file mode 100755 index 0000000..0e53dd0 --- /dev/null +++ b/files/bin/cpu_performance @@ -0,0 +1,12 @@ +#!/bin/sh + +set -eu +case "${0%%*/}" in + *_performance) governor=performance;; + *_powersave) governor=powersave;; + *) exit 1;; +esac + +for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do + sudo -- sh -c "echo $governor > '$f'" +done diff --git a/files/bin/cpu_powersave b/files/bin/cpu_powersave new file mode 120000 index 0000000..84d9762 --- /dev/null +++ b/files/bin/cpu_powersave @@ -0,0 +1 @@ +cpu_performance \ No newline at end of file