Files
oam/knowledge base/optimize battery on a linux system.md
2023-07-09 20:48:18 +02:00

1.9 KiB

Optimize battery on a linux system

Table of contents

  1. TL;DR
  2. Disable unused services
  3. Improve battery performance
  4. Further readings

TL;DR

# Summarize performance of the last boot.
sudo systemd-analyze

# Show last boot performance.
# Also shows the process tree.
sudo systemd-analyze critical-chain

# Check power stats.
sudo 'powertop'

Disable unused services

$ sudo systemd-analyze
Startup finished in 13.129s (firmware) + 5.413s (loader) + 1.746s (kernel) + 7.903s (userspace) = 28.192s
graphical.target reached after 1.239s in userspace

$ sudo systemd-analyze critical-chain
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

graphical.target @1.239s
└─multi-user.target @1.239s
  └─ModemManager.service @1.154s +84ms
    └─polkit.service @937ms +215ms
      └─basic.target @928ms
        └─sockets.target @928ms
          └─dbus.socket @928ms
            └─sysinit.target @924ms
              └─systemd-backlight@backlight:acpi_video0.service @2.273s +8ms
                └─system-systemd\x2dbacklight.slice @2.272s
                  └─system.slice @197ms
                    └─-.slice @197ms

Improve battery performance

# Enable automatic power management.
# See `tlpui` on GitHub for UI.
sudo systemctl enable --now 'tlp.service'
sudo vim '/etc/tlp.conf'

# Check power stats.
sudo 'powertop'

Further readings