org.javasimon.callback.quantiles
Class LinearBuckets
java.lang.Object
org.javasimon.callback.quantiles.Buckets
org.javasimon.callback.quantiles.LinearBuckets
- All Implemented Interfaces:
- LogMessageSource<Split>
public class LinearBuckets
- extends Buckets
Linearly organized Buckets
For 100-600 range and 5 bucket count, the following buckets are created:
| Index |
Min | Max |
Samples |
Counter |
| 0 |
-∞ | 100 |
53 |
# (1) |
| 1 |
100 | 200 |
128,136 |
## (2) |
| 2 |
200 | 300 |
245,231,264,287,275 |
###### (5) |
| 3 |
300 | 400 |
356,341 |
## (2) |
| 4 |
400 | 500 |
461 |
# (1) |
| 5 |
500 | 600 |
801 |
# (1) |
| 6 |
600 | +∞ |
|
(0) |
For a total of 12 splits in this example, we can deduce that
- Median (6th sample) is in bucket #2
- Third quartile (9th sample) is in bucket #3
- 90% percentile (10,8th sample) is in bucket #4 or #5 (but assume #4).
- Author:
- Gérald Quintana, Alexej Vlasov
|
Constructor Summary |
LinearBuckets(long min,
long max,
int bucketNb)
Constructor |
| Methods inherited from class org.javasimon.callback.quantiles.Buckets |
addValue, addValues, clear, estimateQuantile, getBucketNb, getBuckets, getLogMessage, getLogTemplate, getMax, getMedian, getMin, getQuantile, getQuantiles, getQuartiles, log, sample, setLogTemplate, toString |
LinearBuckets
public LinearBuckets(long min,
long max,
int bucketNb)
- Constructor
- Parameters:
min - Duration min (lower bound of all buckets)max - Duration max (upper bound of all buckets)bucketNb - Number of buckets between min and max
getBucketForValue
protected Bucket getBucketForValue(long value)
- Get the bucket containing the given value.
Bucket should be sorted, the bucket whose min/max bounds are around the value is returned.
Override the base method making it generally faster thanks to linear regression.
- Overrides:
getBucketForValue in class Buckets
- Parameters:
value - Value
- Returns:
- Bucket containing given value
Copyright © 2013. All Rights Reserved.