Class DurationStatisticsTracker

java.lang.Object
org.opendaylight.yangtools.util.DurationStatisticsTracker

@Beta public abstract class DurationStatisticsTracker extends Object
Abstract class that calculates and tracks time duration statistics.
Author:
Thomas Pantelis, Robert Varga
  • Constructor Details

    • DurationStatisticsTracker

      public DurationStatisticsTracker()
  • Method Details

    • createConcurrent

      public static DurationStatisticsTracker createConcurrent()
      Create a concurrent DurationStatisticsTracker, which performs well in very contended environments.
      Returns:
      A new instance.
    • createSynchronized

      public static DurationStatisticsTracker createSynchronized()
      Create a synchronized DurationStatisticsTracker, 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.
      Returns:
      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.
      Returns:
      the longest duration in nanoseconds.
    • getShortestDuration

      public final long getShortestDuration()
      Returns the shortest duration in nanoseconds.
      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.
      Returns:
      the average duration in human-readable form.
    • 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.
      Returns:
      The longest duration and when it has occurred in human-readable form.
    • 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.
      Returns:
      The shortest duration and when it has occurred in human-readable form.
    • getTimeOfLongestDuration

      public final long getTimeOfLongestDuration()
      Returns the time stamp of the longest duration.
      Returns:
      the time stamp of the longest duration.
    • getTimeOfShortestDuration

      public final long getTimeOfShortestDuration()
      Returns the time stamp of the shortest duration.
      Returns:
      the time stamp of the shortest duration.