this post was submitted on 16 Jul 2023
53 points (96.5% liked)

Linux

48137 readers
526 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

tl;dr: I'm looking for something like AccuBattery, but for Linux

What do you use to measure laptop battery life in Linux?

I can easily get a momentary estimate of battery life. But this fluctuates based on load, screen backlight etc.

I'm looking for something that will collect my usage patterns over time - load, #processes, screen backlight, ... - and allow me to predict remaining runtime more accurately.

I'd love for the data to be parsable, so that I can analyze it myself and e.g. find the "worst offenders" - processes affecting battery runtime the most.

Thank you for any tips!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 year ago (5 children)

Can't help you directly, but powertop can be used to monitor/tweak momentary power usage.

[–] [email protected] 5 points 1 year ago (4 children)

Thanks, I do like powertop. I think it's pretty good for short measurements, e.g. over 30 seconds:

% sudo powertop --time=30

The battery reports a discharge rate of 4.17 W
The energy consumed was 125 J
The estimated remaining time is 11 hours, 4 minutes

But in the real world I will not be getting 11 hours of runtime. The moment I start a browser or play a video, power consumption goes way up.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago) (1 children)

If you're technically inclined, a simple bash script with a for loop could dump the time and discharge rate to a text file every minute. Then you could copy/paste that into LibreOffice calc and do yourself some pretty graphs, or whatever.

edit: just found a tool called powerstat which looks like it does sampling over longer intervals.

sudo apt install powerstat

[–] [email protected] 1 points 1 year ago

Interesting, hadn't heard of powerstat. I'll be checking that, thanks!

load more comments (2 replies)
load more comments (2 replies)