67

The powertop program shows the power usage, but only after about five minutes. Before that, it shows:

no ACPI power usage estimate available

That's one of the limitations of the powertop program. What program is recommended for reliably monitoring the power usage? Is it possible to get a power usage history similar to the memory usage history in the System Monitor as well?

Lekensteyn
  • 174,277
  • I was just testing with powertop on my laptop and did not noticed any issue like this. What version are you using? – Cas Mar 30 '12 at 01:53
  • I had that issue with 1.13 (the one in Maverick), 1.97 from Oneiric does not show power usage at all. – Lekensteyn Mar 30 '12 at 09:33
  • Are you using this on a latop with the power cable unplugged? Here are screenshots of both powertop versions with power usage showing: http://imgur.com/TA0BS,GresK#0 – Cas Mar 30 '12 at 14:45
  • I've waited for five minutes after unplugging before testing (before that, it uses the line). Checking the source, it seems that powertop 1.97 relies on the "present rate" field for reporting charge rate. My battery always reports "unknown" for it, and I have to use the "remaining capacity" field from /proc/acpi/battery/BAT0/state. – Lekensteyn Mar 30 '12 at 15:17
  • 2
    http://unix.stackexchange.com/questions/68531/return-value-of-current-watt-consumption-on-command-line – Ciro Santilli OurBigBook.com Oct 28 '15 at 19:25

5 Answers5

60

As you surmised in your comment the limitation is not with the software but with your battery not reporting correctly.

To clarify these software tools below will only measure power consumption on laptops when running on battery. For desktop or server machines the only current solution is an electronic watt-meter that plugs into the mains socket.

#Power Statistics

In Ubuntu Precise 12.04 there is a new power statistics history window. This can be accessed by clicking the battery item in the application indicator menu then selecting Latop Battery tab.

#Powertop

As mentioned by the OP this program provides information on per process/device power usage.

#Powerstat

Another alternative that measures process/device power usage is powerstat that was written for Ubuntu by Colin King. There is a detailed review of its features on hecticgeek.com.

It can be installed from the PPA: ppa:colin-king/powermanagement

enter image description here

Cas
  • 8,557
  • +1 nice pics, do you happen to know if Kubuntu 12.04 has a similar program? – Lekensteyn Apr 02 '12 at 20:21
  • Get a Kill-A-Watt http://www.p3international.com/products/p4400.html – nitrl Jul 18 '13 at 15:26
  • 16
    What about power consumption for battery-less computers ? Powerstat doesn't support them (Error message : Machine is not discharging and hence we cannot measure power usage.) – Heisennberg Nov 27 '13 at 23:30
  • 1
    Is it only me, or where does powertop actually show power consumption, in the screenshot above, or elsewhere? – matanox Jun 27 '17 at 08:29
  • @matt battery discharge rate is it. But if you're on AC, then powertop doesn't show anything like this. – Ruslan Nov 24 '17 at 07:49
  • 2
    My name is Colin King coincidentally... When I first saw this answer, I was like, "No way... That's creepy... Who the heck is this Colin King guy because I sure didn't provide this application." –  Jun 18 '18 at 22:07
  • 2
    powerstat is available through apt and snap now. no need for ppa. – qwr Mar 19 '20 at 20:55
  • Update: Powertop can be used for Desktop-powered computers, i.e. computers which do not run on battery. – stephanmg May 27 '21 at 13:25
7

Have a look at s-tui: https://amanusk.github.io/s-tui/. Runs in the terminal, shows you the parameters pertinent to the CPU.

banan314
  • 360
6

You can have a look at PowerAPI (on github), which gives the power consumption at the process level on Linux. According to some experiments, it is more accurate than Powertop.

1

Intel has a cross-platform (MacOS, and Windows) app called 'Intel Power Gadget' which provides for logging of power consumption information, including cumulative power measurements, via a command line version and a GUI version.

Intel have a version of Power Gadget for Linux but it hasn't been updated for a while. There's also an external version that has been modified/updated more recently.

Pierz
  • 3,063
  • 1
  • 25
  • 15
1

I found that only TLP was able to report power consumption in near-realtime (<3 s delay), while at least for my system Gnome Power Statistics (gnome-power-statistics) and upower had a delay of 120 seconds before the values updated again.

To see current power as reported by TLP, use this command:

sudo tlp-stat --battery

Environment: ThinkPad X201 Tablet with Ubuntu 20.04. TLP together with the SMAPI kernel module (that TLP recommends) installed with sudo apt install tlp tp-smapi-dkms, then TLP enabled with sudo tlp start. It may be that the SMAPI kernel module enables the more frequent updates, as it provides a different way to access and configure the battery.

tanius
  • 6,303
  • 1
  • 39
  • 49