Package org.opendaylight.yangtools.util
Class DurationStatisticsTracker
- java.lang.Object
-
- org.opendaylight.yangtools.util.DurationStatisticsTracker
-
-
Constructor Summary
Constructors Constructor Description DurationStatisticsTracker()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addDuration(long duration)
Add a duration to track.static DurationStatisticsTracker
createConcurrent()
Create a concurrentDurationStatisticsTracker
, which performs well in very contended environments.static DurationStatisticsTracker
createSynchronized()
Create a synchronizedDurationStatisticsTracker
, which performs well in non-contended environments.abstract double
getAverageDuration()
Returns the average duration in nanoseconds.String
getDisplayableAverageDuration()
Returns the average duration as a displayable String with units, e.g.String
getDisplayableLongestDuration()
Returns the longest duration as a displayable String with units and the date/time at which it occurred, e.g.String
getDisplayableShortestDuration()
Returns the shortest duration as a displayable String with units and the date/time at which it occurred, e.g.long
getLongestDuration()
Returns the longest duration in nanoseconds.long
getShortestDuration()
Returns the shortest duration in nanoseconds.long
getTimeOfLongestDuration()
Returns the time stamp of the longest duration.long
getTimeOfShortestDuration()
Returns the time stamp of the shortest duration.abstract long
getTotalDurations()
Returns the total number of tracked durations.abstract void
reset()
Resets all statistics back to their defaults.
-
-
-
Method Detail
-
createConcurrent
public static DurationStatisticsTracker createConcurrent()
Create a concurrentDurationStatisticsTracker
, which performs well in very contended environments.- Returns:
- A new instance.
-
createSynchronized
public static DurationStatisticsTracker createSynchronized()
Create a synchronizedDurationStatisticsTracker
, which performs well in non-contended environments.- Returns:
- A new instance.
-
addDuration
public abstract void addDuration(long duration)
Add a duration to track.- Parameters:
duration
- non-negative duration in nanoseconds.
-
getAverageDuration
public abstract double getAverageDuration()
Returns the average duration in nanoseconds.
-
getTotalDurations
public abstract long getTotalDurations()
Returns the total number of tracked durations.- Returns:
- Total number of measurements accumulated since last
reset()
.
-
reset
public abstract void reset()
Resets all statistics back to their defaults.
-
getLongestDuration
public final long getLongestDuration()
Returns the longest duration in nanoseconds.
-
getShortestDuration
public final long getShortestDuration()
Returns the shortest duration in nanoseconds.
-
getDisplayableAverageDuration
public final String getDisplayableAverageDuration()
Returns the average duration as a displayable String with units, e.g. "12.34 ms".
-
getDisplayableLongestDuration
public final String getDisplayableLongestDuration()
Returns the longest duration as a displayable String with units and the date/time at which it occurred, e.g. "12.34 ms at 08/02/2014 12:30:24".
-
getDisplayableShortestDuration
public final String getDisplayableShortestDuration()
Returns the shortest duration as a displayable String with units and the date/time at which it occurred, e.g. "12.34 ms at 08/02/2014 12:30:24".
-
getTimeOfLongestDuration
public final long getTimeOfLongestDuration()
Returns the time stamp of the longest duration.
-
getTimeOfShortestDuration
public final long getTimeOfShortestDuration()
Returns the time stamp of the shortest duration.
-
-