Class DefaultLatencyHistogramStatistic
java.lang.Object
org.terracotta.statistics.derived.latency.DefaultLatencyHistogramStatistic
- All Implemented Interfaces:
LatencyHistogramQuery,LatencyHistogramStatistic,ChainedEventObserver,ChainedObserver
public class DefaultLatencyHistogramStatistic
extends Object
implements LatencyHistogramStatistic, ChainedEventObserver
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BarSplittingBiasedHistogramprivate longprivate final longprivate final LatencyHistogramQueryprivate final LongSupplier -
Constructor Summary
ConstructorsConstructorDescriptionDefaultLatencyHistogramStatistic(double phi, int bucketCount, Duration window) DefaultLatencyHistogramStatistic(double phi, int bucketCount, Duration window, LongSupplier timeSupplier) Create a histogram maintained over a sliding time window. -
Method Summary
Modifier and TypeMethodDescriptionbuckets()longcount()voidevent(long time, long latency) Called to indicate an event happened.maximum()minimum()private static LongnullOrVal(double val) percentile(double percent) long[]percentileBounds(double percent) <T> Tquery(Function<LatencyHistogramQuery, T> fn) Enables to query the histogram several times within a synchronized state so that every calls are consistenttoString()private voidtryExpire(boolean force, LongSupplier time) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.terracotta.statistics.derived.latency.LatencyHistogramQuery
medianMethods inherited from interface org.terracotta.statistics.derived.latency.LatencyHistogramStatistic
maximumStatistic, medianStatistic, minimumStatistic, percentileStatistic
-
Field Details
-
histogram
-
timeSupplier
-
pruningDelay
private final long pruningDelay -
query
-
nextPruning
private long nextPruning
-
-
Constructor Details
-
DefaultLatencyHistogramStatistic
public DefaultLatencyHistogramStatistic(double phi, int bucketCount, Duration window, LongSupplier timeSupplier) Create a histogram maintained over a sliding time window.The constructed histogram is:
- maintained over
windowsliding window - consists of
bucketCountbuckets - where
b1.size() ~= b0.size * phi
- Parameters:
phi- histogram bucket bias factorbucketCount- number of bucketswindow- sliding window size, in nstimeSupplier- the supplier of time, which must be in the same unit as the time passed to the {event(long, long)} method.
- maintained over
-
DefaultLatencyHistogramStatistic
-
-
Method Details
-
buckets
- Specified by:
bucketsin interfaceLatencyHistogramQuery
-
count
public long count()- Specified by:
countin interfaceLatencyHistogramQuery
-
minimum
- Specified by:
minimumin interfaceLatencyHistogramQuery- Returns:
- The minimum value or null if no value
-
maximum
- Specified by:
maximumin interfaceLatencyHistogramQuery- Returns:
- The maximum value or null if no value
-
percentile
- Specified by:
percentilein interfaceLatencyHistogramQuery- Parameters:
percent- the percentage (0.0-1.0)- Returns:
- the value below which percent% of the observations may be found. Will return the upper bound of the approximated range.
-
percentileBounds
public long[] percentileBounds(double percent) - Specified by:
percentileBoundsin interfaceLatencyHistogramQuery- Parameters:
percent- the percentage (0.0-1.0)- Returns:
- the inclusive bounds (min and max) representing the range containing the right value for the given percent%-ile.
-
event
public void event(long time, long latency) Description copied from interface:ChainedEventObserverCalled to indicate an event happened.- Specified by:
eventin interfaceChainedEventObserver- Parameters:
time- the clock at event completion in nslatency- the event latency in ns
-
query
Description copied from interface:LatencyHistogramStatisticEnables to query the histogram several times within a synchronized state so that every calls are consistent- Specified by:
queryin interfaceLatencyHistogramStatistic
-
toString
-
tryExpire
-
nullOrVal
-