public class ExponentialHistogram extends Object
This class is *not thread-safe*, safe consumption in a multi-threaded environment will require some form of external locking.
| Constructor and Description |
|---|
ExponentialHistogram(double epsilon,
long window)
Creates an exponential histogram maintaining a count over
window to within @{epsilon} fractional accuracy. |
| Modifier and Type | Method and Description |
|---|---|
long |
count()
Returns the approximate current count.
|
double |
epsilon()
Return the fractional accuracy of this exponential histogram
|
long |
expire(long time)
Expire old events.
|
void |
insert(long time)
Insert a single event at
time |
void |
insert(long time,
long count)
Bulk insert
count events at time. |
void |
merge(ExponentialHistogram b)
Merge the supplied ExponentialHistogram in to this one.
|
ExponentialHistogram |
split(double fraction)
Split an exponential histogram off this one.
|
String |
toString() |
public ExponentialHistogram(double epsilon,
long window)
window to within @{epsilon} fractional accuracy.epsilon - fractional accuracywindow - sliding window sizepublic void merge(ExponentialHistogram b)
b - histogram to mergeIllegalArgumentException - if the two merge-thresholds are not equalspublic void insert(long time,
long count)
throws IllegalArgumentException
count events at time.time - event timecount - event countIllegalArgumentException - if count is negativepublic void insert(long time)
timetime - event timestamppublic long expire(long time)
time - current timestamppublic long count()
public ExponentialHistogram split(double fraction)
The returned histogram will contain {code fraction} of the events in this one.
fraction - splitting fractionpublic double epsilon()
Copyright © 2018. All rights reserved.