[BetterBatteryStats] chamonix:
The logcat gives some interesting info. Let's look at two different points in time:

I/StatsProvider( 9027): whichRealtime = 48562391 batteryRealtime = 48562391000 timeBatteryUp=1593183
D/StatsProvider( 9027): Added Deep sleep:13 h 2 m 49 s (46969 s) Ratio: 96,7%
D/StatsProvider( 9027): Current value: Deep Sleep 13 h 2 m 49 s (46969 s) Ratio: 96,7%
D/StatsProvider( 9027): Current value: Moderate Signal 9 h 14 m 20 s (33260 s) Ratio: 68,5%
D/StatsProvider( 9027): Current value: Poor Signal 3 h 28 m 56 s (12536 s) Ratio: 25,8%
D/StatsProvider( 9027): Current value: No Data Connection 44 m 37 s (2677 s) Ratio: 5,5%
D/StatsProvider( 9027): Current value: No or Unknown Signal 44 m 37 s (2677 s) Ratio: 5,5%
D/StatsProvider( 9027): Current value: Awake 26 m 33 s (1593 s) Ratio: 3,3%
D/StatsProvider( 9027): Current value: Screen On 17 m 37 s (1057 s) Ratio: 2,2%
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=show keyguard, m_duration=1855] from Wakelock [m_wakeType=0, m_name=show keyguard, m_duration=5731]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=show keyguard, m_duration=3876]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=64313] from Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=10970297]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=10905984]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=CallerInfoCache, m_duration=1322] from Wakelock [m_wakeType=0, m_name=CallerInfoCache, m_duration=1091095]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=CallerInfoCache, m_duration=1089773]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AudioOut_2, m_duration=4752] from Wakelock [m_wakeType=0, m_name=AudioOut_2, m_duration=348339]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AudioOut_2, m_duration=343587]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=18404] from Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=18484]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=80]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=MediaScannerService, m_duration=46424] from Wakelock [m_wakeType=0, m_name=MediaScannerService, m_duration=46424]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=MediaScannerService, m_duration=0]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=14355] from Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=14458]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=103]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=BBS_WAKELOCK_WHILE_SAVING_REF, m_duration=9490] from Wakelock [m_wakeType=0, m_name=BBS_WAKELOCK_WHILE_SAVING_REF, m_duration=11011]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=BBS_WAKELOCK_WHILE_SAVING_REF, m_duration=1521]
D/UpdateMediumWidgetService( 9027): Since: 13 h 26 m 15 s
D/UpdateMediumWidgetService( 9027): Awake: 23 m 50 s
D/UpdateMediumWidgetService( 9027): Deep Sleep: 13 h 2 m 25 s
D/UpdateMediumWidgetService( 9027): Screen on: 15 m 44 s
D/UpdateMediumWidgetService( 9027): PWL: 6 h 38 m 48 s
D/UpdateMediumWidgetService( 9027): KWL: 9 m 20 s

I/StatsProvider( 9027): whichRealtime = 55386369 batteryRealtime = 55386369000 timeBatteryUp=1661786
D/StatsProvider( 9027): Added Deep sleep:14 h 55 m 24 s (53724 s) Ratio: 97,0%
D/StatsProvider( 9027): Current value: Deep Sleep 14 h 55 m 24 s (53724 s) Ratio: 97,0%
D/StatsProvider( 9027): Current value: Moderate Signal 11 h 8 m 4 s (40084 s) Ratio: 72,4%
D/StatsProvider( 9027): Current value: Poor Signal 3 h 28 m 56 s (12536 s) Ratio: 22,6%
D/StatsProvider( 9027): Current value: No Data Connection 44 m 37 s (2677 s) Ratio: 4,8%
D/StatsProvider( 9027): Current value: No or Unknown Signal 44 m 37 s (2677 s) Ratio: 4,8%
D/StatsProvider( 9027): Current value: Awake 27 m 41 s (1661 s) Ratio: 3,0%
D/StatsProvider( 9027): Current value: Screen On 17 m 53 s (1073 s) Ratio: 1,9%
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=show keyguard, m_duration=1855] from Wakelock [m_wakeType=0, m_name=show keyguard, m_duration=6131]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=show keyguard, m_duration=4276]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=64313] from Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=11416474]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=11352161]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=CallerInfoCache, m_duration=1322] from Wakelock [m_wakeType=0, m_name=CallerInfoCache, m_duration=1091095]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=CallerInfoCache, m_duration=1089773]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AudioOut_2, m_duration=4752] from Wakelock [m_wakeType=0, m_name=AudioOut_2, m_duration=356831]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AudioOut_2, m_duration=352079]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=18404] from Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=18484]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=80]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=MediaScannerService, m_duration=46424] from Wakelock [m_wakeType=0, m_name=MediaScannerService, m_duration=46424]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=MediaScannerService, m_duration=0]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=14355] from Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=14458]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=103]
I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=BBS_WAKELOCK_WHILE_SAVING_REF, m_duration=9490] from Wakelock [m_wakeType=0, m_name=BBS_WAKELOCK_WHILE_SAVING_REF, m_duration=11011]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=BBS_WAKELOCK_WHILE_SAVING_REF, m_duration=1521]
D/UpdateMediumWidgetService( 9027): Since: 15 h 19 m 59 s
D/UpdateMediumWidgetService( 9027): Awake: 24 m 58 s
D/UpdateMediumWidgetService( 9027): Deep Sleep: 14 h 55 m
D/UpdateMediumWidgetService( 9027): Screen on: 16 m
D/UpdateMediumWidgetService( 9027): PWL: 7 h 14 m 12 s
D/UpdateMediumWidgetService( 9027): KWL: 10 m 13 s

Now a few checks:

I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=64313] from Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=10970297]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=10905984]

It seems that the calculation is correct:

10970297 - 64313 = 10905984

That would be a little more that 3 hours (values are in ms) is what is displayed is correct from the values. In the other hand the values are pretty high.

Now looking at the second sample taken a few hours later:

I/Wakelock( 9027): Substraction Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=64313] from Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=11416474]
I/Wakelock( 9027): Result: Wakelock [m_wakeType=0, m_name=AlarmManager, m_duration=11352161]

and again

11416474 - 64313 = 11352161

and that is again correct.

Comparing the values:

those samples were taken 1 hour 55 min from each other and the alarm partial wakelock has increased from 10970297 to 11416474 = 446177 ms (7 minutes). On the other hand the difference of "awake" between those readings was hardly one minute.

And finally looking at the system times:

I/StatsProvider( 9027): whichRealtime = 48562391 batteryRealtime = 48562391000 timeBatteryUp=1593183
I/StatsProvider( 9027): whichRealtime = 55386369 batteryRealtime = 55386369000 timeBatteryUp=1661786

whichRealtime went from 48562391 to 55386369 = 1,89 hours, check

Edit: (after digging a little)

Let's very a few theories.

A) those times are not ms but microseconds

in that case 446177 microseconds that would be 0,4 seconds -> a liitle too low for my taste withing 2 hours

B) there is something wrong with the retrieved values because the API is accessed with the wrong constants.

This is how (at an abstract level) the current partial wakelocks are retrieved:

myWakelocks = mStats.getWakelockStats(m_context,
BatteryStatsTypes.WAKE_TYPE_PARTIAL,
[B]BatteryStatsTypes.STATS_CURRENT[/B], iPctType);

BatteryStatsTypes.STATS_CURRENT is a constant (in our case 2) telling the API what to return. Those constants are defined in BatterStats and used in the private API BatteryStatsImpl (for those interested http://grepcode.com/search?query=batterystats&start=0&entity=type&n= and http://grepcode.com/search/?query=batterystatsimpl).

Checking the versions of BatteryStats:

- 4.1.1: public static final int STATS_CURRENT = 2;

- 4.0.4: public static final int STATS_CURRENT = 2;

- 4.0.3: public static final int STATS_CURRENT = 2;

- 4.0.2: public static final int STATS_CURRENT = 2;

- 4.0.1: public static final int STATS_CURRENT = 2;

- 2.3.7: public static final int STATS_CURRENT = 2;

Nothing there either. Except of course this CM10 version has changed those constants. Could you point me to the sources of your cm10 ROM so I can either browse them or check them out?