public static class BatteryStatsImpl.SamplingTimer extends BatteryStatsImpl.Timer
update(long, int)
method. The state of the timer according to its BatteryStatsImpl.TimeBase
will determine how much
of the value is recorded.
If the value being recorded resets, endSample()
can be called in order to
account for the change. If the value passed in to update(long, int)
decreased
between calls, the endSample()
is automatically called and the new value is
expected to increase monotonically from that point on.mClocks, mCount, mLastCount, mLastTime, mLoadedCount, mLoadedTime, mTimeBase, mTimeBeforeMark, mTotalTime, mType, mUnpluggedCount, mUnpluggedTime
Constructor and Description |
---|
SamplingTimer(BatteryStatsImpl.Clocks clocks,
BatteryStatsImpl.TimeBase timeBase) |
SamplingTimer(BatteryStatsImpl.Clocks clocks,
BatteryStatsImpl.TimeBase timeBase,
Parcel in) |
Modifier and Type | Method and Description |
---|---|
void |
add(long deltaTime,
int deltaCount)
Adds deltaTime and deltaCount to the current sample.
|
protected int |
computeCurrentCountLocked() |
protected long |
computeRunTimeLocked(long curBatteryRealtime) |
void |
endSample()
Ends the current sample, allowing subsequent values to
update(long, int) to
be less than the values used for a previous invocation. |
int |
getUpdateVersion() |
void |
logState(Printer pw,
String prefix)
Temporary for debugging.
|
void |
onTimeStarted(long elapsedRealtime,
long baseUptime,
long baseRealtime) |
void |
onTimeStopped(long elapsedRealtime,
long baseUptime,
long baseRealtime) |
boolean |
reset(boolean detachIfReset)
Clear state of this timer.
|
void |
setUpdateVersion(int version) |
void |
update(long totalTime,
int count)
Updates the current recorded values.
|
void |
writeToParcel(Parcel out,
long elapsedRealtimeUs) |
detach, getCountLocked, getTimeSinceMarkLocked, getTotalTimeLocked, readSummaryFromParcelLocked, writeSummaryFromParcelLocked, writeTimerToParcel
getCurrentDurationMsLocked, getMaxDurationMsLocked, isRunningLocked
public SamplingTimer(BatteryStatsImpl.Clocks clocks, BatteryStatsImpl.TimeBase timeBase, Parcel in)
public SamplingTimer(BatteryStatsImpl.Clocks clocks, BatteryStatsImpl.TimeBase timeBase)
public void endSample()
update(long, int)
to
be less than the values used for a previous invocation.public void setUpdateVersion(int version)
public int getUpdateVersion()
public void update(long totalTime, int count)
add(long, int)
.
If the values being recorded have been reset, the monotonically increasing requirement
will be broken. In this case, endSample()
is automatically called and
the total value of totalTime and count are recorded, starting a new monotonically
increasing sample.totalTime
- total time of sample in microseconds.count
- total number of times the event being sampled occurred.public void add(long deltaTime, int deltaCount)
deltaTime
- additional time recorded since the last sampled event, in microseconds.deltaCount
- additional number of times the event being sampled occurred.public void onTimeStarted(long elapsedRealtime, long baseUptime, long baseRealtime)
onTimeStarted
in interface BatteryStatsImpl.TimeBaseObs
onTimeStarted
in class BatteryStatsImpl.Timer
public void onTimeStopped(long elapsedRealtime, long baseUptime, long baseRealtime)
onTimeStopped
in interface BatteryStatsImpl.TimeBaseObs
onTimeStopped
in class BatteryStatsImpl.Timer
public void logState(Printer pw, String prefix)
BatteryStats.Timer
logState
in class BatteryStatsImpl.Timer
protected long computeRunTimeLocked(long curBatteryRealtime)
computeRunTimeLocked
in class BatteryStatsImpl.Timer
protected int computeCurrentCountLocked()
computeCurrentCountLocked
in class BatteryStatsImpl.Timer
public void writeToParcel(Parcel out, long elapsedRealtimeUs)
writeToParcel
in class BatteryStatsImpl.Timer
public boolean reset(boolean detachIfReset)
BatteryStatsImpl.Timer
reset
in class BatteryStatsImpl.Timer