Class LatencySimpleMovingAverage
- java.lang.Object
-
- org.terracotta.statistics.derived.latency.LatencySimpleMovingAverage
-
- All Implemented Interfaces:
LatencyStatistic,ChainedEventObserver,ChainedObserver
public class LatencySimpleMovingAverage extends java.lang.Object implements ChainedEventObserver, LatencyStatistic
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicReference<LatencyPeriodAccumulator>activePartitionprivate java.util.Queue<LatencyPeriodAccumulator>archiveprivate static intPARTITION_COUNTprivate longpartitionSizeprivate longwindowSize
-
Constructor Summary
Constructors Constructor Description LatencySimpleMovingAverage(long time, java.util.concurrent.TimeUnit unit)LatencySimpleMovingAverage(long time, java.util.concurrent.TimeUnit unit, int partitionCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidarchive(LatencyPeriodAccumulator partition)doubleaverage()voidevent(long timeNs, long latencyNs)Called to indicate an event happened.java.lang.Longmaximum()java.lang.Longminimum()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.terracotta.statistics.derived.latency.LatencyStatistic
averageStatistic, maximumStatistic, minimumStatistic
-
-
-
-
Field Detail
-
PARTITION_COUNT
private static final int PARTITION_COUNT
- See Also:
- Constant Field Values
-
archive
private final java.util.Queue<LatencyPeriodAccumulator> archive
-
activePartition
private final java.util.concurrent.atomic.AtomicReference<LatencyPeriodAccumulator> activePartition
-
windowSize
private final long windowSize
-
partitionSize
private final long partitionSize
-
-
Method Detail
-
average
public final double average()
- Specified by:
averagein interfaceLatencyStatistic- Returns:
- The average in ns or NaN if no value
-
maximum
public final java.lang.Long maximum()
- Specified by:
maximumin interfaceLatencyStatistic- Returns:
- The maximum in ns or null if it does not exist yet
-
minimum
public final java.lang.Long minimum()
- Specified by:
minimumin interfaceLatencyStatistic- Returns:
- The minimum in ns or null if it does not exist yet
-
event
public void event(long timeNs, long latencyNs)Description copied from interface:ChainedEventObserverCalled to indicate an event happened.- Specified by:
eventin interfaceChainedEventObserver- Parameters:
timeNs- the clock at event completion in nslatencyNs- the event latency in ns
-
archive
private void archive(LatencyPeriodAccumulator partition)
-
-