Battery information logging and analysis on OS X (Python3)
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



BatterylogX is a set of tools for logging and later analyzing laptop battery power data such as voltage and charge/discharge current. The goal is to have an easy-to-use (and maintain) toolkit for analyzing battery performance.

Currently implemented is battery data logger only. The data is stored in a sqlite3 database. The data logger supports daemonizing (run in background).

Recorded information

The following information is stored:

  • timestamp
  • battery serial number
  • voltage
  • amperage
  • capacity

Much more information would be available but I did not see the usefulness of other fields yet.

Data analysis

Some ideas for data analysis (later) are listed here:

  • Sleep detection (no data)
  • How long was the system in sleep?
  • How much capacity was drained in sleep?
  • Charge/discharge cycle detection (based on amperage)
  • What was the average power during a discharge cycle
  • Full charge time?

System requirements

These programs are written for Python 3.2, but should also work with version 2.7. The battery information is read using system_profiler, an Apple proprietary utility. It should be trivial to port this to other platforms, but since I don't have non-Apple laptops, I'm not going to implement it. I am willing to integrate changes made by others as long as they do not break functionality for me.


All this code is open source under the MIT license. The full text is duplicated in the file LICENSE.