Adventures in Battery Life on Arch Linux

Recently, I purchased an Asus ux303ln which is advertised as having an 8 hour battery life. I promptly then wiped the drive and installed Arch Linux which has only been giving me about two hours of battery life. I started doing some research and found some suggestions on how to improve battery life, so I am going to go through each one and measure the power usage to see how each one individually affects battery life. To measure battery usage, I am going to use powerstat at boot while idling, and when I get down to 30% battery I am going to use uptime to measure how long the battery lasts. The uptime tests won't be "scientific" in that I will be using my laptop during the time the power is draining but I'll try to keep my usage as consistent as possible (no youtube, no video games).

Establish a baseline

First I will go through the motions for my unmodified system.

Running for 300.0 seconds (30 samples at 10.0 second intervals).
ACPI battery power measurements will start in 180 seconds time.

  Time    User  Nice   Sys  Idle    IO  Run Ctxt/s  IRQ/s Fork Exec Exit  Watts
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Average   0.2   0.0   0.0  99.8   0.0  1.0   85.4   22.5  0.0  0.0  0.4  13.10
  StdDev   0.1   0.0   0.0   0.1   0.0  0.0    4.9    1.8  0.2  0.0  1.7   0.09
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Minimum   0.1   0.0   0.0  99.7   0.0  1.0   76.3   19.8  0.0  0.0  0.0  13.03
 Maximum   0.3   0.0   0.1  99.9   0.0  1.0   98.0   28.6  1.0  0.0  9.0  13.48
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
Summary:
 13.10 Watts on Average with Standard Deviation 0.09

And my uptime at 30% battery:

15:53:59 up  1:59,  0 users,  load average: 0.51, 0.37, 0.24

Which assuming linear consumption of battery I'd theoretically have 2 hours and 50 minutes of battery life.

Enabling power saving on the intel graphics

To enable power saving on the Intel graphics all I need to do is create /etc/modprobe.d/i915.conf with these contents:

options i915 enable_rc6=1 enable_fbc=1 lvds_downclock=1
Running for 300.0 seconds (30 samples at 10.0 second intervals).
ACPI battery power measurements will start in 180 seconds time.

  Time    User  Nice   Sys  Idle    IO  Run Ctxt/s  IRQ/s Fork Exec Exit  Watts
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Average   0.2   0.0   0.0  99.8   0.0  1.1   85.9   23.9  0.0  0.0  0.4  12.46
  StdDev   0.1   0.0   0.0   0.1   0.0  0.2    9.1    6.8  0.2  0.0  1.5   0.09
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Minimum   0.1   0.0   0.0  99.6   0.0  1.0   73.8   17.4  0.0  0.0  0.0  12.37
 Maximum   0.3   0.0   0.1  99.9   0.0  2.0  119.2   55.1  1.0  0.0  8.0  12.82
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
Summary:
 12.46 Watts on Average with Standard Deviation 0.09

And my uptime at 30% battery:

21:33:49 up  2:05,  0 users,  load average: 0.05, 0.08, 0.12

Which assuming linear consumption of battery I'd theoretically have 2 hours and 58 minutes of battery life. This change did slightly improve battery life but it wasn't a significant change.

Enabling PCIe Force ASPM

Next I added pcie_aspm=force to the kernel boot line

Running for 300.0 seconds (30 samples at 10.0 second intervals).
ACPI battery power measurements will start in 180 seconds time.

  Time    User  Nice   Sys  Idle    IO  Run Ctxt/s  IRQ/s Fork Exec Exit  Watts
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Average   0.2   0.0   0.0  99.7   0.0  1.0   89.5   26.3  0.1  0.0  0.5  11.76
  StdDev   0.1   0.0   0.0   0.1   0.0  0.0   15.1    9.9  0.2  0.0  1.7   0.06
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Minimum   0.1   0.0   0.0  99.5   0.0  1.0   75.0   19.2  0.0  0.0  0.0  11.69
 Maximum   0.4   0.0   0.1  99.8   0.0  1.0  149.5   69.6  1.0  0.0  9.0  11.94
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
Summary:
 11.76 Watts on Average with Standard Deviation 0.06

And my uptime at 30% battery

03:54:08 up  2:12,  0 users,  load average: 0.02, 0.09, 0.10

Which assuming linear consumption of battery I'd theoretically have 3 hours and 8 minutes of battery life. This change did slightly improve battery life but it wasn't a significant change.

Install powerdown

Next I install powerdown-git from the aur. In addition for this step I keep backlight brightness at max

Running for 300.0 seconds (30 samples at 10.0 second intervals).
ACPI battery power measurements will start in 180 seconds time.

  Time    User  Nice   Sys  Idle    IO  Run Ctxt/s  IRQ/s Fork Exec Exit  Watts
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Average   0.2   0.0   0.0  99.7   0.0  1.1   95.2   26.7  0.0  0.0  0.3  11.11
  StdDev   0.1   0.0   0.0   0.1   0.0  0.4   32.8   16.3  0.2  0.0  1.5   0.10
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Minimum   0.1   0.0   0.0  99.6   0.0  1.0   78.3   19.3  0.0  0.0  0.0  11.00
 Maximum   0.3   0.0   0.1  99.8   0.1  3.0  265.3  112.9  1.0  0.0  8.0  11.45
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
Summary:
 11.11 Watts on Average with Standard Deviation 0.10

And my uptime at 30% battery

22:41:50 up  2:00,  0 users,  load average: 0.29, 0.30, 0.25

Oddly enough my power usage went down but the battery life did too. I suspect its just a symptom of my non-scientific test. The resting watts are really the only "scientific" part of this post.

Use Bumblebee to turn off nvidia card

Running for 300.0 seconds (30 samples at 10.0 second intervals).
ACPI battery power measurements will start in 180 seconds time.

  Time    User  Nice   Sys  Idle    IO  Run Ctxt/s  IRQ/s Fork Exec Exit  Watts
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Average   0.3   0.0   0.0  99.7   0.0  1.0   90.8   57.0  0.2  0.1  0.1   8.32
  StdDev   0.1   0.0   0.0   0.1   0.0  0.2    9.5    5.5  0.7  0.4  0.5   0.12
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Minimum   0.2   0.0   0.0  99.4   0.0  1.0   78.2   50.3  0.0  0.0  0.0   8.26
 Maximum   0.4   0.0   0.1  99.8   0.0  2.0  120.7   71.1  4.0  2.0  2.0   8.74
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
Summary:
  8.32 Watts on Average with Standard Deviation 0.12

My uptime at 30% battery:

18:31:11 up  2:57,  0 users,  load average: 0.27, 0.39, 0.24

Which would get us to 4 hours and 12 minutes total

Enable PSR (Panel Self Refresh)

In /etc/modprobe.d/i915.conf I added enable_psr=1. Check out http://blog.vivi.eng.br/?p=187 for details. You can check its status with:

sudo cat /sys/kernel/debug/dri/0/i915_edp_psr_status
Running for 300.0 seconds (30 samples at 10.0 second intervals).
ACPI battery power measurements will start in 180 seconds time.

  Time    User  Nice   Sys  Idle    IO  Run Ctxt/s  IRQ/s Fork Exec Exit  Watts
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Average   0.3   0.0   0.0  99.7   0.0  1.0   89.7   60.7  0.0  0.0  0.0   8.04
  StdDev   0.1   0.0   0.0   0.1   0.0  0.0    9.0   11.5  0.2  0.0  0.0   0.97
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Minimum   0.2   0.0   0.0  99.5   0.0  1.0   79.2   50.5  0.0  0.0  0.0   7.35
 Maximum   0.4   0.0   0.1  99.8   0.0  1.0  114.6   87.9  1.0  0.0  0.0  11.62
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
Summary:
  8.04 Watts on Average with Standard Deviation 0.97

My uptime at 30% battery:

00:42:13 up  3:49,  0 users,  load average: 0.00, 0.03, 0.09

which would get us to 5 hours and 27 minutes

Bonus round (changing brightness)

So far, all of my changes have been based on imperceptible changes to my experience using the laptop. For funsies, I decided I should see what power usage I am at when I let powerdown reduce my backlight (which it automatically does on battery power, but I've been turning the backlight back to max).

$ bc -l <<< "$(cat /sys/class/backlight/intel_backlight/brightness) / $(cat /sys/class/backlight/intel_backlight/max_brightness) * 100"
20.00000000000000000000

Looks like powerdown is setting my brightness to 20% when I unplug my laptop. And now the powerstat:

  Time    User  Nice   Sys  Idle    IO  Run Ctxt/s  IRQ/s Fork Exec Exit  Watts
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Average   0.3   0.0   0.1  99.6   0.0  1.1  127.0   38.6  0.1  0.0  0.3   4.43
  StdDev   0.0   0.0   0.0   0.1   0.0  0.3   11.7    6.9  0.2  0.0  1.6   0.01
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
 Minimum   0.2   0.0   0.0  99.5   0.0  1.0  114.1   34.3  0.0  0.0  0.0   4.41
 Maximum   0.4   0.0   0.1  99.7   0.1  2.0  172.4   70.8  1.0  0.0  9.0   4.44
-------- ----- ----- ----- ----- ----- ---- ------ ------ ---- ---- ---- ------
Summary:
  4.43 Watts on Average with Standard Deviation 0.01

So it seems that I could get considerable boosts to my battery life if I allow my brightness to be turned down, perhaps exceeding the advertised 8 hours of battery life that I am supposed to get on windows.

Comments

Comments powered by Disqus