Class MaximumLatencyHistory
- java.lang.Object
-
- org.terracotta.statistics.derived.latency.MaximumLatencyHistory
-
- All Implemented Interfaces:
ChainedEventObserver,ChainedObserver,SampledStatistic<Long>,ValueStatistic<Long>
public class MaximumLatencyHistory extends Object implements ChainedEventObserver, SampledStatistic<Long>
Keeps a history of the maximum operation latencies over a specific window. The window needs to be as small as possible to get the most detailed history.This is important to note that the history is based on a sample count and not a time frame. If you set a history to 100 samples and a window of 500ms, you won't have a complete time-frame of 10 seconds. You can have a sample at t0, then another one at t0 + 1 sec depending on when the operations occur.
- Author:
- Mathieu Carbou
-
-
Constructor Summary
Constructors Constructor Description MaximumLatencyHistory(int historySize, long windowSize, TimeUnit windowSizeUnit, LongSupplier timeSupplier)MaximumLatencyHistory(int historySize, long windowSize, TimeUnit windowSizeUnit, LongSupplier timeSupplier, Consumer<LatencyPeriodAccumulator> sink)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevent(long timeNs, long latencyNs)Called to indicate an event happened.List<Sample<Long>>history()The history of valuesList<Sample<Long>>history(long sinceMillis)The history of values, since a given time in msStatisticTypetype()Longvalue()
-
-
-
Constructor Detail
-
MaximumLatencyHistory
public MaximumLatencyHistory(int historySize, long windowSize, TimeUnit windowSizeUnit, LongSupplier timeSupplier)
-
MaximumLatencyHistory
public MaximumLatencyHistory(int historySize, long windowSize, TimeUnit windowSizeUnit, LongSupplier timeSupplier, Consumer<LatencyPeriodAccumulator> sink)- Parameters:
historySize- The number of samples to keepwindowSize- The size of the window over which the reduction is applied. A small value is better for more details, but history might discard values faster.windowSizeUnit- Window size unitsink- The sink used to collect the old values that are discarded from the history.
-
-
Method Detail
-
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
-
value
public Long value()
- Specified by:
valuein interfaceValueStatistic<Long>- Returns:
- The current statistic value
-
type
public StatisticType type()
- Specified by:
typein interfaceValueStatistic<Long>- Returns:
- The statistic type
-
history
public List<Sample<Long>> history()
Description copied from interface:SampledStatisticThe history of values- Specified by:
historyin interfaceSampledStatistic<Long>- Returns:
- the list
-
history
public List<Sample<Long>> history(long sinceMillis)
Description copied from interface:SampledStatisticThe history of values, since a given time in ms- Specified by:
historyin interfaceSampledStatistic<Long>- Parameters:
sinceMillis- starting point of history in ms- Returns:
- the list
-
-