Class TimeDistributionRecorder


public class TimeDistributionRecorder extends TimeRecorder
Utility class to collect distribution of timings with a logarithmic time scale.

Returns minimum, maximum and average time of sampled intervals. Also returns distribution of samples between intervals on a logarithmic time scale.

Since:
2018-01-04
  • Constructor Details

    • TimeDistributionRecorder

      public TimeDistributionRecorder(double maxSecs, double minSecs, int logSteps)
      Constructor for TimeDistributionRecorder.
      Parameters:
      maxSecs - Largest time to be recorded (will be rounded up to next power of 10)
      minSecs - Smallest time to be recorded (will be rounded down to next power of 10)
      logSteps - Number of subdivisions per power of 10 (logarithmic spaced)
    • TimeDistributionRecorder

      public TimeDistributionRecorder(double maxSecs, double minSecs)
      Constructor for TimeDistributionRecorder.

      Uses default of 5 steps per power of 10.

      Parameters:
      maxSecs - Largest time to be recorded (will be rounded up to next power of 10)
      minSecs - Smallest time to be recorded (will be rounded down to next power of 10)
    • TimeDistributionRecorder

      public TimeDistributionRecorder()
      Constructor for TimeDistributionRecorder.

      Uses default of 5 steps per power of 10 and a range from 1/10 to 1e-5 seconds.

  • Method Details

    • reset

      public void reset()
      Description copied from class: ContinuousValueRecorder
      Reset all recorded values.
      Overrides:
      reset in class ContinuousValueRecorder
    • recordNanos

      public double recordNanos(long nanos)
      Description copied from class: TimeRecorder
      Record a time sample of given length.
      Overrides:
      recordNanos in class TimeRecorder
      Parameters:
      nanos - Sample interval in nano seconds to record
      Returns:
      Sample interval in seconds
    • timeToIndex

      public int timeToIndex(double secs)
      Compute the bin index of a given time span.
      Parameters:
      secs - Time span in seconds
      Returns:
      Index of bin for time interval
    • indexToTime

      public double indexToTime(int index)
      Compute the minimum sample value for a bin by bin index.

      All values for the bin are guaranteed to be larger or equal than this value and less than the minimum of any previous bin. The last bin always has a minimum of 0.

      Parameters:
      index - Bin index
      Returns:
      Minimum time in seconds
    • size

      public int size()
      Return number of bins.
      Returns:
      Integer count
    • get

      public long get(int index)
      Return count of values for a bin.
      Parameters:
      index - Bin index
      Returns:
      Long count
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class TimeRecorder
    • formatHeader

      public void formatHeader(@Nonnull Formatter formatter, @Nonnull String columnFormatHeader)
      Overrides:
      formatHeader in class TimeRecorder
    • formatValues

      public void formatValues(@Nonnull Formatter formatter, @Nonnull String columnFormatValue)
      Overrides:
      formatValues in class TimeRecorder
    • formatValues

      public void formatValues(@Nonnull Formatter formatter, long normalValue)
    • formatValues

      public void formatValues(@Nonnull Formatter formatter, long normalValue, @Nonnull String columnFormatValue)