|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmessif.statistics.Statistics<StatisticTimer>
messif.statistics.StatisticTimer
public final class StatisticTimer
Statistics for counting time. The time is incremented by the amount of time elapsed between calls to methods start() & stop(). Note that additional calls to start will have no affect until stop is called. Update & set methods will leave current statistics stopped/started state untouched, but they will add values including elapsed time if started. An example: get() => 0 milis start() 1000 milis elapsed get() => 1000 milis 100 milis elapsed get() => 1100 milis stop() 1000 milis elapsed get() => 1100 milis
Field Summary | |
---|---|
protected long |
lastStartTime
Time of the last call to start() of started statistics |
protected long |
time
Time elapsed between calls to start() and stop() . |
Fields inherited from class messif.statistics.Statistics |
---|
replaceWith |
Constructor Summary | |
---|---|
protected |
StatisticTimer(java.lang.String name)
Creates a new instance of StatisticTimer |
Method Summary | |
---|---|
protected void |
addBoundStat(StatisticTimer stat)
Bind a statistic to this statistic. |
protected StatisticTimer |
cast()
Returns this statistics as the type provided typed argument. |
long |
get()
Time elapsed in msec. |
static StatisticTimer |
getStatistics(java.lang.String name)
Factory method for creating a new statistic timer with the specified name or get the one already existing. |
boolean |
changedSinceCheckpoint()
Test whether this statistics has been changed since the last checkpoint. |
protected void |
removeBoundStat(StatisticTimer stat)
Remove a bound statistic from this one. |
void |
reset()
Reset the value of this statistic. |
protected void |
setFrom(StatisticTimer sourceStat)
Set the value of this statistic to the actual value of the given sourceStat . |
void |
setCheckpoint()
Sets checkpoint. |
void |
start()
Starts incrementing the timer |
void |
stop()
Stops incrementing timer |
java.lang.String |
toString()
|
protected void |
updateFrom(StatisticTimer sourceStat)
Updates the value of this statistic from the given sourceStat . |
Methods inherited from class messif.statistics.Statistics |
---|
bindTo, canPerformOperation, disableGlobally, enableGlobally, getAllStatistics, getAllStatistics, getBoundStats, getBoundTo, getName, getStatistics, isBound, isEnabledGlobally, isRegisteredGlobally, printStatistics, printStatistics, printStatistics, readResolve, removeStatistic, resetStatistics, resetStatistics, unbind |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected long time
start()
and stop()
.
protected long lastStartTime
start()
of started statistics
Constructor Detail |
---|
protected StatisticTimer(java.lang.String name)
name
- requested name of the statiticsMethod Detail |
---|
public void start()
public void stop()
public long get()
protected void addBoundStat(StatisticTimer stat)
Statistics
stat
to receive notifications when
the value of this statistic is updated.
addBoundStat
in class Statistics<StatisticTimer>
stat
- the statistic to registerprotected void removeBoundStat(StatisticTimer stat)
Statistics
removeBoundStat
in class Statistics<StatisticTimer>
stat
- the statistic to unbindprotected void updateFrom(StatisticTimer sourceStat)
Statistics
sourceStat
.
Specifically, this method merges the value of the sourceStat
with this statistic.
The actual implementation depends on the type of the statistic.
updateFrom
in class Statistics<StatisticTimer>
sourceStat
- the statistic from which to update this statprotected void setFrom(StatisticTimer sourceStat)
Statistics
sourceStat
.
setFrom
in class Statistics<StatisticTimer>
sourceStat
- the statistic from which to set this statpublic void reset()
Statistics
reset
in class Statistics<StatisticTimer>
public static StatisticTimer getStatistics(java.lang.String name) throws java.lang.ClassCastException
name
- requested name of the statistics
StatisticTimer
having the passed name.
java.lang.ClassCastException
- if the statistics of the given name exists, but is of a different class than StatisticTimer
public java.lang.String toString()
toString
in class java.lang.Object
public boolean changedSinceCheckpoint()
true
if it has been changed, otherwise false
.public void setCheckpoint()
protected StatisticTimer cast()
Statistics
cast
in class Statistics<StatisticTimer>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |