Omarchy

How-To: Measure Your Linux Laptop’s Battery Drain While Asleep

Leave a comment

The Aurora deep-sleep work got me curious how my own laptops do overnight. You don’t need special gear. The battery already reports what it has left.

1. See what sleep mode you use

cat /sys/power/mem_sleep
# [s2idle] deep   = s2idle is active; "deep" is suspend-to-RAM if offered

2. Read the battery before and after

B=/sys/class/power_supply/BAT0
cat $B/energy_now 2>/dev/null || cat $B/charge_now; date +%s

Unplug, note both numbers, run systemctl suspend, leave it for an hour or more, wake it and read them again. energy_now is in µWh. Divide the drop by the hours asleep to get µW, then by 1,000,000 for watts. (If you only get charge_now, multiply by voltage_now.)

3. Confirm it really slept

journalctl -b -u systemd-suspend.service --no-pager | tail
sudo cat /sys/kernel/debug/suspend_stats 2>/dev/null | head

Tips

  • Run it twice. The first sleep after boot can be noisy.
  • Unplug USB devices. They can keep it awake or drain power.
  • Write down kernel version and mode so you can compare after updates.

God Bless, and May the Source Be with You!

References & Further Reading

Subscribe (RSS) Follow How-Tos via RSS

Leave a note

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.