org.apache.cassandra.utils
Class EstimatedHistogram

java.lang.Object
  extended by org.apache.cassandra.utils.EstimatedHistogram

public class EstimatedHistogram
extends java.lang.Object


Nested Class Summary
static class EstimatedHistogram.EstimatedHistogramSerializer
           
 
Field Summary
static EstimatedHistogram.EstimatedHistogramSerializer serializer
           
 
Constructor Summary
EstimatedHistogram()
           
EstimatedHistogram(int bucketCount)
           
EstimatedHistogram(long[] offsets, long[] bucketData)
           
 
Method Summary
 void add(long n)
          Increments the count of the bucket closest to n, rounding UP.
 boolean equals(java.lang.Object o)
           
 long[] getBucketOffsets()
           
 long[] getBuckets(boolean reset)
           
 boolean isOverflowed()
           
 long max()
           
 long mean()
           
 long min()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serializer

public static EstimatedHistogram.EstimatedHistogramSerializer serializer
Constructor Detail

EstimatedHistogram

public EstimatedHistogram()

EstimatedHistogram

public EstimatedHistogram(int bucketCount)

EstimatedHistogram

public EstimatedHistogram(long[] offsets,
                          long[] bucketData)
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 -

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.

mean

public long mean()
Returns:
the mean histogram value (average of bucket offsets, weighted by count)
Throws:
java.lang.IllegalStateException - if any values were greater than the largest bucket threshold

isOverflowed

public boolean isOverflowed()
Returns:
true if this histogram has overflowed -- that is, a value larger than our largest bucket could bound was added

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2011 The Apache Software Foundation