- java.lang.Object
-
- com.pervasive.datarush.monitoring.AccumulatedTimer
-
- All Implemented Interfaces:
AccumulatedTimerSupplier,StatisticSupplier
public final class AccumulatedTimer extends Object implements AccumulatedTimerSupplier
Basic mutable implementation ofAccumulatedTimerSupplier.
-
-
Constructor Summary
Constructors Constructor Description AccumulatedTimer()Creates a new timer in theStatisticState.UNAVAILABLEstate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAccumulatedTimeMillis()The accumulated time so far.StatisticStategetState()Returns the current state of the supplier.voidpause()Pauses the timer; time will not accumulate until the next call tostart().AccumulatedTimerSuppliersnapshot()Creates a snapshot of this timer.voidstart()Starts the timer; time will begin to accumulatevoidstop()Stops the timer.
-
-
-
Constructor Detail
-
AccumulatedTimer
public AccumulatedTimer()
Creates a new timer in theStatisticState.UNAVAILABLEstate.
-
-
Method Detail
-
getState
public StatisticState getState()
Description copied from interface:StatisticSupplierReturns the current state of the supplier.- Specified by:
getStatein interfaceStatisticSupplier- Returns:
- the state of the supplier
-
start
public void start()
Starts the timer; time will begin to accumulate- Throws:
IllegalStateException- if the timer is already started or has finished
-
pause
public void pause()
Pauses the timer; time will not accumulate until the next call tostart().
-
stop
public void stop()
Stops the timer. This method can be called while in any state and thus is safe to call within afinallyblock.
-
getAccumulatedTimeMillis
public long getAccumulatedTimeMillis()
Description copied from interface:AccumulatedTimerSupplierThe accumulated time so far. For aggregations, this is the sum over all partitions of the to be the sum over all partitions of the partition'sAccumulatedTimerSupplier.getAccumulatedTimeMillis(). This value is undefined if the timer isStatisticState.UNAVAILABLE.- Specified by:
getAccumulatedTimeMillisin interfaceAccumulatedTimerSupplier- Returns:
- the accumulated time in milliseconds.
-
snapshot
public AccumulatedTimerSupplier snapshot()
Description copied from interface:AccumulatedTimerSupplierCreates a snapshot of this timer. If the timer is in theStatisticState.ACTIVE- Specified by:
snapshotin interfaceAccumulatedTimerSupplier- Specified by:
snapshotin interfaceStatisticSupplier- Returns:
- a snapshot of this statistic.
-
-