Package org.caffinitas.ohc.histo
Class EstimatedHistogram
- java.lang.Object
-
- org.caffinitas.ohc.histo.EstimatedHistogram
-
public class EstimatedHistogram extends Object
-
-
Constructor Summary
Constructors Constructor Description EstimatedHistogram()
EstimatedHistogram(int bucketCount)
EstimatedHistogram(long[] offsets, long[] bucketData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(long n)
Increments the count of the bucket closest to n, rounding UP.long
count()
boolean
equals(Object o)
long[]
getBucketOffsets()
long[]
getBuckets(boolean reset)
int
hashCode()
boolean
isOverflowed()
void
log(org.slf4j.Logger log)
log.debug() every record in the histogramlong
max()
long
mean()
long
min()
long
percentile(double percentile)
String
toString()
-
-
-
Method Detail
-
getBucketOffsets
public long[] getBucketOffsets()
- Returns:
- the histogram values corresponding to each bucket index
-
add
public void add(long n)
Increments the count of the bucket closest to n, rounding UP.- Parameters:
n
- value to add
-
getBuckets
public long[] getBuckets(boolean reset)
- Parameters:
reset
- zero out buckets afterwards if true- Returns:
- a long[] containing the current histogram buckets
-
min
public long min()
- Returns:
- the smallest value that could have been added to this histogram
-
max
public long max()
- Returns:
- the largest value that could have been added to this histogram. If the histogram overflowed, returns Long.MAX_VALUE.
-
percentile
public long percentile(double percentile)
- Parameters:
percentile
- percentile- Returns:
- estimated value at given percentile
-
mean
public long mean()
- Returns:
- the mean histogram value (average of bucket offsets, weighted by count)
- Throws:
IllegalStateException
- if any values were greater than the largest bucket threshold
-
count
public long count()
- Returns:
- the total number of non-zero values
-
isOverflowed
public boolean isOverflowed()
- Returns:
- true if this histogram has overflowed -- that is, a value larger than our largest bucket could bound was added
-
log
public void log(org.slf4j.Logger log)
log.debug() every record in the histogram- Parameters:
log
- logger to log to
-
-