public abstract static class BatteryStatsImpl.Timer extends BatteryStats.Timer implements BatteryStatsImpl.TimeBaseObs
Modifier and Type | Field and Description |
---|---|
protected BatteryStatsImpl.Clocks |
mClocks |
protected int |
mCount |
protected int |
mLastCount |
protected long |
mLastTime
The run time of the last run of the system, as loaded from the
saved data.
|
protected int |
mLoadedCount |
protected long |
mLoadedTime
The total time we loaded for the previous runs.
|
protected BatteryStatsImpl.TimeBase |
mTimeBase |
protected long |
mTimeBeforeMark
The total time this timer has been running until the latest mark has been set.
|
protected long |
mTotalTime
The total time we have accumulated since the start of the original
boot, to the last time something interesting happened in the
current run.
|
protected int |
mType |
protected int |
mUnpluggedCount |
protected long |
mUnpluggedTime
The value of mTotalTime when unplug() was last called.
|
Constructor and Description |
---|
Timer(BatteryStatsImpl.Clocks clocks,
int type,
BatteryStatsImpl.TimeBase timeBase) |
Timer(BatteryStatsImpl.Clocks clocks,
int type,
BatteryStatsImpl.TimeBase timeBase,
Parcel in)
Constructs from a parcel.
|
Modifier and Type | Method and Description |
---|---|
protected abstract int |
computeCurrentCountLocked() |
protected abstract long |
computeRunTimeLocked(long curBatteryRealtime) |
void |
detach() |
int |
getCountLocked(int which)
Returns the count associated with this Timer for the
selected type of statistics.
|
long |
getTimeSinceMarkLocked(long elapsedRealtimeUs)
Returns the total time in microseconds associated with this Timer since the
'mark' was last set.
|
long |
getTotalTimeLocked(long elapsedRealtimeUs,
int which)
Returns the total time in microseconds associated with this Timer for the
selected type of statistics.
|
void |
logState(Printer pw,
String prefix)
Temporary for debugging.
|
void |
onTimeStarted(long elapsedRealtime,
long timeBaseUptime,
long baseRealtime) |
void |
onTimeStopped(long elapsedRealtime,
long baseUptime,
long baseRealtime) |
void |
readSummaryFromParcelLocked(Parcel in) |
boolean |
reset(boolean detachIfReset)
Clear state of this timer.
|
void |
writeSummaryFromParcelLocked(Parcel out,
long elapsedRealtimeUs) |
static void |
writeTimerToParcel(Parcel out,
BatteryStatsImpl.Timer timer,
long elapsedRealtimeUs)
Writes a possibly null Timer to a Parcel.
|
void |
writeToParcel(Parcel out,
long elapsedRealtimeUs) |
getCurrentDurationMsLocked, getMaxDurationMsLocked, isRunningLocked
protected final BatteryStatsImpl.Clocks mClocks
protected final int mType
protected final BatteryStatsImpl.TimeBase mTimeBase
protected int mCount
protected int mLoadedCount
protected int mLastCount
protected int mUnpluggedCount
protected long mTotalTime
protected long mLoadedTime
protected long mLastTime
protected long mUnpluggedTime
protected long mTimeBeforeMark
public Timer(BatteryStatsImpl.Clocks clocks, int type, BatteryStatsImpl.TimeBase timeBase, Parcel in)
type
- timeBase
- in
- public Timer(BatteryStatsImpl.Clocks clocks, int type, BatteryStatsImpl.TimeBase timeBase)
protected abstract long computeRunTimeLocked(long curBatteryRealtime)
protected abstract int computeCurrentCountLocked()
public boolean reset(boolean detachIfReset)
public void detach()
public void writeToParcel(Parcel out, long elapsedRealtimeUs)
public void onTimeStarted(long elapsedRealtime, long timeBaseUptime, long baseRealtime)
onTimeStarted
in interface BatteryStatsImpl.TimeBaseObs
public void onTimeStopped(long elapsedRealtime, long baseUptime, long baseRealtime)
onTimeStopped
in interface BatteryStatsImpl.TimeBaseObs
public static void writeTimerToParcel(Parcel out, BatteryStatsImpl.Timer timer, long elapsedRealtimeUs)
out
- the Parcel to be written to.timer
- a Timer, or null.public long getTotalTimeLocked(long elapsedRealtimeUs, int which)
BatteryStats.Timer
getTotalTimeLocked
in class BatteryStats.Timer
elapsedRealtimeUs
- current elapsed realtime of system in microsecondswhich
- one of STATS_SINCE_CHARGED, STATS_SINCE_UNPLUGGED, or STATS_CURRENTpublic int getCountLocked(int which)
BatteryStats.Timer
getCountLocked
in class BatteryStats.Timer
which
- one of STATS_SINCE_CHARGED, STATS_SINCE_UNPLUGGED, or STATS_CURRENTpublic long getTimeSinceMarkLocked(long elapsedRealtimeUs)
BatteryStats.Timer
getTimeSinceMarkLocked
in class BatteryStats.Timer
elapsedRealtimeUs
- current elapsed realtime of system in microsecondspublic void logState(Printer pw, String prefix)
BatteryStats.Timer
logState
in class BatteryStats.Timer
public void writeSummaryFromParcelLocked(Parcel out, long elapsedRealtimeUs)
public void readSummaryFromParcelLocked(Parcel in)