@InterfaceAudience.Private @InterfaceStability.Evolving public class FastLongHistogram extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
FastLongHistogram.Bins
Bins is a class containing a list of buckets(or bins) for estimation histogram of some data.
|
Modifier and Type | Field and Description |
---|---|
private FastLongHistogram.Bins |
bins |
static int |
DEFAULT_NBINS
Default number of bins.
|
static double[] |
DEFAULT_QUANTILES |
Modifier | Constructor and Description |
---|---|
|
FastLongHistogram()
Constructor.
|
private |
FastLongHistogram(FastLongHistogram.Bins bins) |
|
FastLongHistogram(int numOfBins)
Constructor.
|
|
FastLongHistogram(int numOfBins,
long min,
long max)
Constructor setting the bins assuming a uniform distribution within a range.
|
Modifier and Type | Method and Description |
---|---|
void |
add(long value,
long count)
Adds a value to the histogram.
|
long |
getCount() |
long |
getMax() |
long |
getMean() |
long |
getMin() |
long |
getNumAtOrBelow(long value) |
long[] |
getQuantiles() |
long[] |
getQuantiles(double[] quantiles)
Computes the quantiles give the ratios.
|
Snapshot |
snapshotAndReset()
Resets the histogram for new counting.
|
public static final int DEFAULT_NBINS
public static final double[] DEFAULT_QUANTILES
private volatile FastLongHistogram.Bins bins
public FastLongHistogram()
public FastLongHistogram(int numOfBins)
numOfBins
- the number of bins for the histogram. A larger value results in more precise
results but with lower efficiency, and vice versus.public FastLongHistogram(int numOfBins, long min, long max)
numOfBins
- the number of bins for the histogram. A larger value results in more precise
results but with lower efficiency, and vice versus.min
- lower bound of the region, inclusive.max
- higher bound of the region, inclusive.private FastLongHistogram(FastLongHistogram.Bins bins)
public void add(long value, long count)
public long[] getQuantiles(double[] quantiles)
public long[] getQuantiles()
public long getMin()
public long getMax()
public long getCount()
public long getMean()
public long getNumAtOrBelow(long value)
public Snapshot snapshotAndReset()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.