org.javasimon.callback.quantiles
Class ExponentialBuckets

java.lang.Object
  extended by org.javasimon.callback.quantiles.Buckets
      extended by org.javasimon.callback.quantiles.ExponentialBuckets
All Implemented Interfaces:
LogMessageSource<Split>

public class ExponentialBuckets
extends Buckets

Exponentially organized Buckets.

Author:
Alexej Vlasov

Field Summary
private  double logMin
          Logarithm of the lower bound.
private  double power
          Power between buckets.
 
Fields inherited from class org.javasimon.callback.quantiles.Buckets
bucketNb, buckets, max, min
 
Constructor Summary
ExponentialBuckets(long min, long max, int bucketNb)
          Constructor.
 
Method Summary
protected  double estimateQuantile(Bucket bucket, double expectedCount, double lastCount)
          Interpolate quantile located in given Bucket using linear regression.
protected  Bucket getBucketForValue(long value)
          Get the bucket containing the given value.
 
Methods inherited from class org.javasimon.callback.quantiles.Buckets
addValue, addValues, clear, 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
 

Field Detail

power

private final double power
Power between buckets.


logMin

private final double logMin
Logarithm of the lower bound.

Constructor Detail

ExponentialBuckets

public ExponentialBuckets(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 faster thanks to exponential regression.

Overrides:
getBucketForValue in class Buckets
Parameters:
value - Value
Returns:
Bucket containing given value

estimateQuantile

protected double estimateQuantile(Bucket bucket,
                                  double expectedCount,
                                  double lastCount)
Interpolate quantile located in given Bucket using linear regression.

Used during quantiles computation to do exponential regression over one bucket.

Overrides:
estimateQuantile in class Buckets
Parameters:
bucket - Current bucket containing the quantile
expectedCount - Searched value
lastCount - Value of the bucket lower bound
Returns:
Compute quantile


Copyright © 2013. All Rights Reserved.