Add UMA statistic to track Off (S5/G3) power consumption.
It should be feasible to track 'powered off' power consumption and report a metric similar to standby by storing a timestamp & battery's state-of-charge right at shutdown and then querying similarly during startup.
Psuedo-code might look like,
if (shutdown && on_battery)
write_stat(end_session_ts, end_session_soc)
if (startup && on_battery)
read_stat(&end_session_ts, &end_session_soc)
if ((current_soc < end_session_soc) && (to_hrs(current_ts - end_session_ts) > MIN_HRS_FOR_OFF_UMA))
write_uma(Power.BatteryDischargeRateWhileOff, s5_power)
One consideration will need be minimum time we should require shutdown to last in order to minimize the variability of power consumed after publishing measurement on shutdown & again on startup.
May also be able to leverage enhancements within the embedded controller to store S5 power value instead which should decrease the S0 overhead and perhaps remove the need for MIN_HRS_FOR_OFF_UMA. This would require a new EC FW and host command so probably a refinement for later.
Comment 1 by derat@chromium.org
, Mar 23 2018