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
- Author:
- Mathieu Carbou
-
-
Constructor Summary
Constructors Constructor Description DefaultLatencyHistogramStatistic(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Histogram.Bucket>buckets()longcount()voidevent(long time, long latency)Called to indicate an event happened.Longmaximum()Longminimum()Longpercentile(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 consistentStringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.terracotta.statistics.derived.latency.LatencyHistogramQuery
median
-
Methods inherited from interface org.terracotta.statistics.derived.latency.LatencyHistogramStatistic
maximumStatistic, medianStatistic, minimumStatistic, percentileStatistic
-
-
-
-
Constructor Detail
-
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
public DefaultLatencyHistogramStatistic(double phi, int bucketCount, Duration window)
-
-
Method Detail
-
buckets
public List<Histogram.Bucket> buckets()
- Specified by:
bucketsin interfaceLatencyHistogramQuery
-
count
public long count()
- Specified by:
countin interfaceLatencyHistogramQuery
-
minimum
public Long minimum()
- Specified by:
minimumin interfaceLatencyHistogramQuery- Returns:
- The minimum value or null if no value
-
maximum
public Long maximum()
- Specified by:
maximumin interfaceLatencyHistogramQuery- Returns:
- The maximum value or null if no value
-
percentile
public Long percentile(double percent)
- 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
public <T> T query(Function<LatencyHistogramQuery,T> fn)
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
-
-