Class LatencyPeriodAccumulator

java.lang.Object
org.terracotta.statistics.derived.latency.LatencyPeriodAccumulator
All Implemented Interfaces:
LatencyStatistic, ChainedEventObserver, ChainedObserver

public class LatencyPeriodAccumulator extends Object implements LatencyStatistic, ChainedEventObserver
  • Field Details

    • accumulator

      private final LatencyAccumulator accumulator
    • start

      private final long start
    • end

      private final long end
  • Constructor Details

    • LatencyPeriodAccumulator

      LatencyPeriodAccumulator(long start, long length, long... latencies)
  • Method Details

    • isBefore

      public boolean isBefore(long time)
    • isAfter

      public boolean isAfter(long time)
    • start

      public long start()
      Returns:
      Start time (inclusive) for this period.
    • end

      public long end()
      Returns:
      End time (exclusive) for this period.
    • accumulator

      public LatencyAccumulator accumulator()
    • tryAccumulate

      public boolean tryAccumulate(long time, long latency)
    • event

      public void event(long timeNs, long latencyNs)
      Description copied from interface: ChainedEventObserver
      Called to indicate an event happened.
      Specified by:
      event in interface ChainedEventObserver
      Parameters:
      timeNs - the clock at event completion in ns
      latencyNs - the event latency in ns
    • minimum

      public Long minimum()
      Specified by:
      minimum in interface LatencyStatistic
      Returns:
      The minimum in ns or null if it does not exist yet
    • maximum

      public Long maximum()
      Specified by:
      maximum in interface LatencyStatistic
      Returns:
      The maximum in ns or null if it does not exist yet
    • average

      public double average()
      Specified by:
      average in interface LatencyStatistic
      Returns:
      The average in ns or NaN if no value
    • toString

      public String toString()
      Overrides:
      toString in class Object