Open martinsuchan opened 8 years ago
Does this option not work on Windows 10?
@AenBleidd This works on Windows 10, but users might choose to run BOINC on battery and suspend it only when Battery Saver is On. Not sure, how common this might be, but it's recommended for Windows apps to suspend all resource intensive tasks when Battery Saver is on. Maybe Boinc Manager should suspend the computation every time when Battery Saver is on, no matter what the settings is in the Computing preferences?
As I understand from your link above Battery Saver option means that application should exclude some 'hard' functilnality to keep less energy using. So IMHO this option in complex with existing option is unnecessary for BOINC.
@RichardHaselgrove, do we really need this feature to be implemented?
Probably not. "Compute on battery" defaults to no and I doubt anyone changes that.
Per message https://setiathome.berkeley.edu/forum_thread.php?id=84719&postid=2014098, the Suspend computation when on battery does not work in Ubuntu.
The mechanism that is used in Windows works. Whatever the mechanism is in Windows probably has the equivalent function in Linux. The code for suspending when on battery needs to be updated to handle Linux hosts also.
This command upower --enumerate
produces an output that hints at which interface needs to be polled.
upower --enumerate /org/freedesktop/UPower/devices/ups_hiddev0
This is the interface that the system uses to poll the APCUPSD USB connection from the UPS. This is how the UPS signals the host to gracefully shutdown once the UPS battery level or time remaining falls below the configuration setpoint and causes the host to exit all applications and shutdown. This mechanism works fine in Linux.
What is wanted is the "Suspend all computations when on battery" Manager preferences to stop computations so the UPS battery does not have compute loads on it and the on battery time remaining is increased by dropping to idle load.
Further investigation shows the daemon upowerd is running on Linux systems monitoring all battery powered devices.
upower -d
shows all the devices and the current state of all battery devices. The final output of that command is:
Daemon:
daemon-version: 0.99.7
on-battery: no
lid-is-closed: no
lid-is-present: no
critical-action: PowerOff
and could be used to hook into with whatever the Manager or Client uses to stop computing when the host is on system battery.
gboolean
up_client_get_on_battery (UpClient *client);
True=on battery False=not on battery This would be the method for the Manager to detect when the host has shifted to battery power. https://upower.freedesktop.org/docs/
upower -i /org/freedesktop/UPower/devices/ups_hiddev0 is the interface that needs to be interrogated.
The code in the module /client/hostinfo_unix.cpp needs to be updated for the correct, current interfaces in use for battery detection.
UPower solution is implemented in #3425
WIN11. Suspend when computer is on battery checked, but BOINC still computes when UPS is engaged, this runs the UPS down in 20 min. Currently UPS controlled by UPSmart.
You will have to grab the fix in #3425 and compile your own client and give it a try. Detecting whether the computer is on a UPS is supposed to work on Windows. At least it does for Windows laptops. The fix in #3425 is just for polling Upower interface in Linux which changes the status polled by apcupsd. Sounds like they need to work on detecting the same kind of interface in Windows which I assume is controlled by UPSmart. That fix has never been merged into the Master client.
Windows 10 OS contains feature called Battery Saver. It can be enabled when running on battery to conserve battery usage by lowering CPU/GPU frequency, stopping background tasks or lowering screen brightness. It would be useful to add switch to the BOINC Manager to enable/disable computation when the device is on Battery Saver. The Battery Saver status can be detected using this API.