Class ExponentialHistogramGenerator
java.lang.Object
org.elasticsearch.exponentialhistogram.ExponentialHistogramGenerator
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,Releasable
public class ExponentialHistogramGenerator
extends Object
implements org.apache.lucene.util.Accountable, Releasable
Only intended for use in tests currently.
A class for accumulating raw values into an
ExponentialHistogram with a given maximum number of buckets.
If the number of values is less than or equal to the bucket capacity, the resulting histogram is guaranteed
to represent the exact raw values with a relative error less than 2^(2^-MAX_SCALE) - 1.-
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double value) Adds the given value to the histogram.voidclose()create(int maxBucketCount, ExponentialHistogramCircuitBreaker circuitBreaker) Creates a new instance with the specified maximum number of buckets.Returns the histogram representing the distribution of all accumulated values.longMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
Method Details
-
create
public static ExponentialHistogramGenerator create(int maxBucketCount, ExponentialHistogramCircuitBreaker circuitBreaker) Creates a new instance with the specified maximum number of buckets.- Parameters:
maxBucketCount- the maximum number of buckets for the generated histogramcircuitBreaker- the circuit breaker to use to limit memory allocations
-
add
public void add(double value) Adds the given value to the histogram.- Parameters:
value- the value to add
-
getAndClear
Returns the histogram representing the distribution of all accumulated values.- Returns:
- the histogram representing the distribution of all accumulated values
-
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable
-