1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-29 18:07:45 +00:00

watt: turn into a library

This commit is contained in:
RGBCube 2025-06-14 22:54:46 +03:00
parent 3c82679ada
commit a341d08c45
Signed by: RGBCube
SSH key fingerprint: SHA256:CzqbPcfwt+GxFYNnFVCqoN5Itn4YFrshg1TrnACpA5M
11 changed files with 115 additions and 84 deletions

114
watt/config.toml Normal file
View file

@ -0,0 +1,114 @@
# Watt Default Configuration
# Rules are evaluated by priority (higher number => higher priority).
# Each rule can specify conditions and actions for CPU and power management.
# Emergency thermal protection (highest priority).
[[rule]]
if = { value = "$cpu-temperature", is-more-than = 85.0 }
priority = 100
cpu.energy-performance-preference = "power"
cpu.frequency-mhz-maximum = 2000
cpu.governor = "powersave"
cpu.turbo = false
# Critical battery preservation.
[[rule]]
if.all = [ "?discharging", { value = "%power-supply-charge", is-less-than = 0.3 } ]
priority = 90
cpu.energy-performance-preference = "power"
cpu.frequency-mhz-maximum = 800 # More aggressive below critical threshold.
cpu.governor = "powersave"
cpu.turbo = false
power.platform-profile = "low-power"
# High performance mode for sustained high load.
[[rule]]
if.all = [
{ value = "%cpu-usage", is-more-than = 0.8 },
{ value = "$cpu-idle-seconds", is-less-than = 30.0 },
{ value = "$cpu-temperature", is-less-than = 75.0 },
]
priority = 80
cpu.energy-performance-preference = "performance"
cpu.governor = "performance"
cpu.turbo = true
# Performance mode when not discharging.
[[rule]]
if.all = [
{ not = "?discharging" },
{ value = "%cpu-usage", is-more-than = 0.1 },
{ value = "$cpu-temperature", is-less-than = 80.0 },
]
priority = 70
cpu.energy-performance-bias = "balance_performance"
cpu.energy-performance-preference = "performance"
cpu.governor = "performance"
cpu.turbo = true
# Moderate performance for medium load.
[[rule]]
if.all = [
{ value = "%cpu-usage", is-more-than = 0.4 },
{ value = "%cpu-usage", is-less-than = 0.8 },
]
priority = 60
cpu.energy-performance-preference = "balance_performance"
cpu.governor = "schedutil"
# Power saving during low activity.
[[rule]]
if.all = [
{ value = "%cpu-usage", is-less-than = 0.2 },
{ value = "$cpu-idle-seconds", is-more-than = 60.0 },
]
priority = 50
cpu.energy-performance-preference = "power"
cpu.governor = "powersave"
cpu.turbo = false
# Extended idle power optimization.
[[rule]]
if = { value = "$cpu-idle-seconds", is-more-than = 300.0 }
priority = 40
cpu.energy-performance-preference = "power"
cpu.frequency-mhz-maximum = 1600
cpu.governor = "powersave"
cpu.turbo = false
# Battery conservation when discharging.
[[rule]]
if.all = [ "?discharging", { value = "%power-supply-charge", is-less-than = 0.5 } ]
priority = 30
cpu.energy-performance-preference = "power"
cpu.frequency-mhz-maximum = 2000
cpu.governor = "powersave"
cpu.turbo = false
power.platform-profile = "low-power"
# General battery mode.
[[rule]]
if = "?discharging"
priority = 20
cpu.energy-performance-bias = "balance_power"
cpu.energy-performance-preference = "power"
cpu.frequency-mhz-maximum = 1800
cpu.frequency-mhz-minimum = 200
cpu.governor = "powersave"
cpu.turbo = false
# Balanced performance for general use. Default fallback rule.
[[rule]]
cpu.energy-performance-preference = "balance_performance"
cpu.governor = "schedutil"
priority = 0