Talk:Per-Activity Power Usage
 Measuring power events
The abstract "power per activity" numbers may not be too useful to end-users, but they would be very useful to developers, seeking to optimize the power usage of the system in general and of particularly egregious activities.
Small changes to the system, made soon, that would merely record the key information needed for this analysis, would be great. Things like:
- Activity startup and shutdown, and foregrounding should trigger a coulomb counter reading.
- Logging of the times and precipitating events that caused sleeps and wakeups, along with coulomb counter readings.
- Logging of other power-related events such as screen dimming, enabling or disabling WiFi or Mesh, plugging or removing USB or SD.
Note that the coulomb counter only works when the system is running without external power. Also, the coulomb counter is extremely hard to read; the CPU has to ask the EC which communicates over a slow and cumbersome 1-wire interface into the battery pack. Putting a coulomb counter on the main power supply, directly and cheaply readable by the CPU (and/or providing a way for software to interrupt the incoming external power at will, thus throwing the system onto its battery), would improve automatic measurement of power in ordinary operation. Also, the counter has limited short-term precision, though it does better over the long term; see its data sheet: Maxim DS2756 data sheet.
A logging infrastructure that kept this info in a few pages of RAM in a daemon, and only wrote them out upon each shutdown or lid-close suspension, would provide lots of data collection without much flash wear or performance impact. In the current hardware, the logging should probably not occur when on AC power, since the coulomb counter provides little useful info in that case.