Power-Management – Where Does Gnome-Power-Statistics Get Its Data From

power-management

Gnome-power-statistics is run when you click on the battery icon in the top panel of a laptop. It shows battery history such as charge and rate, as well as statistics such as discharge profile and discharge accuracy.

gnome power statistics discharge profile

The more you use your laptop, the more data it shows, and the more accurate the battery time-to-empty predictions are.

So, where does gnome-power-statistics get the raw historical data from?
And, if it also saves any data, where does it save it to?

Best Answer

I've just answered a simular question here, but here is the summary:

UPower's historical information is stored in four files in /var/lib/upower/, yours will be different but mine are named:

./var/lib/upower/history-time-empty-DELL_KP4377-57-22096.dat
./var/lib/upower/history-time-full-DELL_KP4377-57-22096.dat
./var/lib/upower/history-charge-DELL_KP4377-57-22096.dat
./var/lib/upower/history-rate-DELL_KP4377-57-22096.dat

It appears to compile this data from the information in /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0 which I'm guessing is in turn directly taken from acpi's information on the current battery state at /proc/acpi/battery/BAT0/info.

Hope this helps.