Class DurationStatisticsTracker


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

      • DurationStatisticsTracker

        public DurationStatisticsTracker()
    • Method Detail

      • 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.