diff --git a/README.md b/README.md index 159f856..80acccc 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,9 @@ By default, auto-cpufreq does not use the config file! If you wish to use it, th # preferred governor governor = performance +# EPP: see available preferences by running: cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences +energy_performance_preference = performance + # minimum cpu frequency (in kHz) # example: for 800 MHz = 800000 kHz --> scaling_min_freq = 800000 # see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html @@ -307,6 +310,9 @@ turbo = auto # preferred governor governor = powersave +# EPP: see available preferences by running: cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences +energy_performance_preference = power + # minimum cpu frequency (in kHz) # example: for 800 MHz = 800000 kHz --> scaling_min_freq = 800000 # see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html diff --git a/auto-cpufreq.conf-example b/auto-cpufreq.conf-example index 3a141ac..3ede8ae 100644 --- a/auto-cpufreq.conf-example +++ b/auto-cpufreq.conf-example @@ -4,6 +4,9 @@ # preferred governor. governor = performance +# EPP: see available preferences by running: cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences +energy_performance_preference = performance + # minimum cpu frequency (in kHz) # example: for 800 MHz = 800000 kHz --> scaling_min_freq = 800000 # see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html @@ -25,6 +28,9 @@ turbo = auto # preferred governor governor = powersave +# EPP: see available preferences by running: cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences +energy_performance_preference = power + # minimum cpu frequency (in kHz) # example: for 800 MHz = 800000 kHz --> scaling_min_freq = 800000 # see conversion info: https://www.rapidtables.com/convert/frequency/mhz-to-hz.html diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py index 0ef4315..76ece27 100755 --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py @@ -676,8 +676,15 @@ def set_powersave(): Path("/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference").exists() and Path("/sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost").exists() is False ): - run("cpufreqctl.auto-cpufreq --epp --set=balance_power", shell=True) - print('Setting to use: "balance_power" EPP') + if conf.has_option("battery", "energy_performance_preference"): + epp = conf["battery"]["energy_performance_preference"] + run(f"cpufreqctl.auto-cpufreq --epp --set={epp}", shell=True) + print(f'Setting to use: "{epp}" EPP') + else: + run("cpufreqctl.auto-cpufreq --epp --set=balance_power", shell=True) + print('Setting to use: "balance_power" EPP') + else: + print('Not setting EPP (not supported by system)') # set frequencies set_frequencies() @@ -887,8 +894,15 @@ def set_performance(): Path("/sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference").exists() and Path("/sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost").exists() is False ): - run("cpufreqctl.auto-cpufreq --epp --set=balance_performance", shell=True) - print('Setting to use: "balance_performance" EPP') + if conf.has_option("charger", "energy_performance_preference"): + epp = conf["charger"]["energy_performance_preference"] + run(f"cpufreqctl.auto-cpufreq --epp --set={epp}", shell=True) + print(f'Setting to use: "{epp}" EPP') + else: + run("cpufreqctl.auto-cpufreq --epp --set=balance_performance", shell=True) + print('Setting to use: "balance_performance" EPP') + else: + print('Not setting EPP (not supported by system)') # set frequencies set_frequencies()