coyote/cpupower/cpupower.sh
Thomas Gebert 0b4237805d Control CPU frequency and idle settings
This selection of script, config and systemd unit file shall give
control over configuring the CPU behaviour with cpupower on startup.

Since SuSE does not ship anything we have to write our own...
2024-09-19 14:36:35 +02:00

37 lines
975 B
Bash

#!/bin/bash
CPUPOWER_CONFIG="/etc/default/cpupower"
if [ -f "${CPUPOWER_CONFIG}" ]; then
source "${CPUPOWER_CONFIG}"
else
exit 0
fi
print_header() {
cat << HEADER
###############################################################################
# ${@}
###############################################################################
HEADER
}
# Set the CPU governor
if [ ! "${CPU_GOVERNOR}" == "" ]; then
print_header "Setting CPU governor to ${CPU_GOVERNOR}"
cpupower frequency-set --governor "${CPU_GOVERNOR}" &> /dev/null
cpupower frequency-info
else
echo "CPU governor is not set."
fi
# Set the Cstate by latency
if [ ! "${CPU_CSTATES_DISABLE_BY_LATENCY}" == "" ]; then
print_header "Setting CPU CStates by latency to ${CPU_CSTATES_DISABLE_BY_LATENCY}"
cpupower idle-set --disable-by-latency "${CPU_CSTATES_DISABLE_BY_LATENCY}" &> /dev/null
cpupower idle-info
else
echo "No CPU Cstates by latency configured."
fi