]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/sleep/sleep.c
sleep: store battery discharge rate/hour with hash 23640/head
authorSonali Srivastava <srivastava.sonali1@gmail.com>
Wed, 20 Jul 2022 09:17:04 +0000 (14:47 +0530)
committerSonali Srivastava <srivastava.sonali1@gmail.com>
Wed, 20 Jul 2022 12:09:07 +0000 (17:39 +0530)
commit91ea7ebcdfac18137a1f3d1e89d99917ad66d87f
tree696d22a49f7ccad2cf14321da2f50c821854f92d
parent96d662fa4c8cab24da57523c5e49e6ef3967fc13
sleep: store battery discharge rate/hour with hash

Estimated battery discharge rate per hour is stored in :
/var/lib/systemd/sleep/battery_discharge_percentage_rate_per_hour

This value is used to determine the initial suspend interval. In case
this file is not available or value is invalid, HibernateDelaySec
interval is used.
After wakeup from initial suspend, this value is again estimated and
written to file if value is in range of 1-199.

Logs for reference : HibernateDelaySec=15min
- Updated in /etc/systemd/sleep.conf

Jul 14 19:17:58 localhost systemd-sleep[567]: Current battery charge
percentage: 100%
Jul 14 19:17:58 localhost systemd-sleep[567]: Failed to read discharge
rate from /var/lib/systemd/sleep/batt
ery_discharge_percentage_rate_per_hour: No such file or directory
Jul 14 19:17:58 localhost systemd-sleep[567]: Set timerfd wake alarm
for 15min
Jul 14 19:33:00 localhost systemd-sleep[567]: Current battery charge
percentage after wakeup: 90%
Jul 14 19:33:00 localhost systemd-sleep[567]: Attempting to estimate
battery discharge rate after wakeup from 15min sleep
Jul 14 19:33:00 localhost systemd-sleep[567]: product_id does not
exist: No such file or directory
Jul 14 19:33:00 localhost systemd-sleep[567]: Estimated discharge rate
39 successfully updated to
/var/lib/systemd/sleep/battery_discharge_percentage_rate_per_hour
Jul 14 19:33:00 localhost systemd-sleep[567]: Current battery charge
percentage: 90%
Jul 14 19:33:00 localhost systemd-sleep[567]: product_id does not
exist: No such file or directory
Jul 14 19:33:00 localhost systemd-sleep[567]: Set timerfd wake alarm
for 1h 48min 27s
Jul 14 21:21:30 localhost systemd-sleep[567]: Current battery charge
percentage after wakeup: 90%
Jul 14 21:21:30 localhost systemd-sleep[567]: Battery was not
discharged during suspension
man/systemd-sleep.conf.xml
src/shared/sleep-config.c
src/shared/sleep-config.h
src/sleep/sleep.c