Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:X0F:HSF
pm-profiler
onbattery.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File onbattery.patch of Package pm-profiler
When on UPS battery, low power consumption is crucial while waiting for power to return. Therefore go to lowest possible CPU frequency and "powersave" governor. There is no code in pm-profiler to switch to this profile on power loss, this has to be done elsewhere, e.g. in a apcupsd hook (/etc/apcupsd/{on,off}battery). --- pm-profiler-0.1_20111222/tools/enable-profile.orig 2015-09-24 12:55:10.809416632 +0200 +++ pm-profiler-0.1_20111222/tools/enable-profile 2015-09-24 13:08:02.197673670 +0200 @@ -44,6 +44,32 @@ function cpufreq_governor { done } +function cpufreq_reset_scaling_max_freq { + for I in /sys/devices/system/cpu/cpu[[:digit:]]*/cpufreq; do + if [ -r "$I/cpuinfo_max_freq" -a -w "$I/scaling_max_freq" ]; then + Maxvalue=`cat $I/cpuinfo_max_freq` + Maxscalingvalue=`cat $I/scaling_max_freq` + if [ "$Maxvalue" != "$Maxscalingvalue" ]; then + echo "$Maxvalue" > $I/scaling_max_freq + fi + fi + done +} + +function cpufreq_minimize_scaling_max_freq { + for I in /sys/devices/system/cpu/cpu[[:digit:]]*/cpufreq; do + Driver=`cat $I/scaling_driver` + Governor=`cat $I/scaling_governor` + # the acpi-cpufreq powersave governor already minimizes frequency + if [ "$Driver" = "intel_pstate" -o "$Governor" != "powersave" ]; then + if [ -r "$I/cpuinfo_max_freq" -a -r "$I/cpuinfo_min_freq" -a -w "$I/scaling_max_freq" ]; then + Minvalue=`cat $I/cpuinfo_min_freq` + echo "$Minvalue" > $I/scaling_max_freq + fi + fi + done +} + function cpufreq_ondemand_up_threshold { # kernel 3.1 onwards has some cpufreq params at a new toplevel location if [ -f /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold ]; then @@ -103,7 +129,12 @@ function read_ahead_kb { done } + +# in case scaling_max_freq has been reduced, reset value to avoid surprises +cpufreq_reset_scaling_max_freq + [ -n "$CPUFREQ_GOVERNOR" ] && cpufreq_governor +[ -n "$CPUFREQ_MINIMIZE_SCALING_MAX_FREQ" ] && cpufreq_minimize_scaling_max_freq [ -n "$CPUFREQ_ONDEMAND_UP_THRESHOLD" ] && cpufreq_ondemand_up_threshold [ -n "$CPUFREQ_ONDEMAND_SAMPLING_RATE" ] && cpufreq_ondemand_sampling_rate [ -n "$CPUFREQ_ONDEMAND_POWERSAVE_BIAS" ] && cpufreq_ondemand_powersave_bias --- pm-profiler-0.1_20111222/doc/config.template.orig 2011-12-22 08:36:52.000000000 +0100 +++ pm-profiler-0.1_20111222/doc/config.template 2015-09-24 12:26:41.530627277 +0200 @@ -15,6 +15,16 @@ DESCRIPTION="" # CPUFREQ_GOVERNOR="" +# Minimize the cpu frequency to the minimum allowed value +# Possible values: Empty string (default) or any non-null string to enable. +# pm-profiler will reset frequency to full speed if not set. +# +# Kernel documentation: admin-guide/pm/cpufreq.rst +# +# File: /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq +# +CPUFREQ_MINIMIZE_SCALING_MAX_FREQ="" + # See http://www.lesswatts.org/tips/cpu.php for a good explanation about # what it does # --- /dev/null 1970-01-01 01:00:00.000000000 +0100 +++ pm-profiler-0.1_20111222/profiles/onbattery/config 2015-09-24 12:33:44.066367524 +0200 @@ -0,0 +1,7 @@ +NAME="Onbattery" +DESCRIPTION="Profile optimized for running on UPS battery." +CPUFREQ_GOVERNOR="powersave" +CPUFREQ_MINIMIZE_SCALING_MAX_FREQ="1" +SATA_ALPM="min_power" +DIRTY_WRITEBACK_CENTISECS="500" +READ_AHEAD_KB="128"
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor