org.javasimon.callback.quantiles
Class LinearBuckets

java.lang.Object
  extended by org.javasimon.callback.quantiles.Buckets
      extended by 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 MinMax Samples Counter
0 -∞100 53 # (1)
1 100200 128,136 ## (2)
2 200300 245,231,264,287,275 ###### (5)
3 300400 356,341 ## (2)
4 400500 461 # (1)
5 500600 801 # (1)
6 600+∞ (0)
For a total of 12 splits in this example, we can deduce that

Author:
Gérald Quintana, Alexej Vlasov

Field Summary
 
Fields inherited from class org.javasimon.callback.quantiles.Buckets
bucketNb, buckets, max, min
 
Constructor Summary
LinearBuckets(long min, long max, int bucketNb)
          Constructor
 
Method Summary
protected  Bucket getBucketForValue(long value)
          Get the bucket containing the given value.
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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
Method Detail

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.