Class TimeRecorder
- java.lang.Object
-
- com.levigo.jadice.server.core.util.monitoring.TimeRecorder
-
-
Constructor Summary
Constructors Constructor Description TimeRecorder(int numberRecentObservations)
Create a new statistic recorder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObservation(long duration, TimeUnit unit)
Add an observation.void
addObservation(Long milliseconds)
Add an observation.long
getAverage()
long
getLastObservation()
long
getMaximum()
long
getMinimun()
long
getNumberOfObservations()
long
getRecentAverage()
long
getRecentMaximum()
long
getRecentMinimum()
void
reset()
Clear all data recorded so far.
-
-
-
Method Detail
-
addObservation
public void addObservation(Long milliseconds)
Add an observation.- Specified by:
addObservation
in interfaceRecorder<Long>
- Parameters:
milliseconds
- Duration of the observation in milliseconds
-
addObservation
public void addObservation(long duration, TimeUnit unit)
Add an observation.- Parameters:
duration
- Duration of the observationunit
-TimeUnit
of the observation.
-
getNumberOfObservations
public long getNumberOfObservations()
- Returns:
- The number of observations recorded so far.
-
getMaximum
public long getMaximum()
- Returns:
- The maximum duration in milliseconds of all observations for far. Is
0
if there are no observations yet.
-
getMinimun
public long getMinimun()
- Returns:
- The minimum duration in milliseconds of all observations for far. Is
0
if there are no observations yet.
-
getAverage
public long getAverage()
- Returns:
- The average duration in milliseconds of all observations for far. Is
0
if there are no observations yet.
-
getRecentMaximum
public long getRecentMaximum()
- Returns:
- The maximum duration in milliseconds of the recent observations. Is
0
if there are no observations yet.
-
getRecentMinimum
public long getRecentMinimum()
- Returns:
- The minimum duration in milliseconds of the recent observations. Is
0
if there are no observations yet.
-
getRecentAverage
public long getRecentAverage()
- Returns:
- The average duration in milliseconds of the recent observations. Is
0
if there are no observations yet.
-
getLastObservation
public long getLastObservation()
- Returns:
- The duration in milliseconds of the last observation. Is
0
if there are no observations yet.
-
-