public class StatsBuffer
extends java.lang.Object
Constructor and Description |
---|
StatsBuffer(int size,
double[] percentiles)
Create a circular buffer that will be used to record values and compute useful stats.
|
Modifier and Type | Method and Description |
---|---|
void |
computeStats()
Compute stats for the current set of values.
|
int |
getCount()
Get the number of entries recorded.
|
long |
getMax()
Get the max of the values currently in our buffer.
|
double |
getMean()
Get the average of the values recorded.
|
long |
getMin()
Get the minimum of the values currently in our buffer.
|
double[] |
getPercentiles()
Return the percentiles we will compute: For example: 95.0, 99.0.
|
double[] |
getPercentileValues()
Get the computed percentileValues.
|
double |
getStdDev()
Get the standard deviation for the population of the recorded values present in our buffer.
|
long |
getTotalTime()
Get the total sum of the values recorded.
|
double |
getVariance()
Get the variance for the population of the recorded values present in our buffer.
|
void |
record(long n)
Record a new value for this buffer.
|
void |
reset()
Reset our local state: All values are set to 0.
|
public StatsBuffer(int size, double[] percentiles)
size
- The capacity of the bufferpercentiles
- Array of percentiles to compute. For example { 95.0, 99.0 }.
If no percentileValues are required pass a 0-sized array.public void reset()
public void record(long n)
public void computeStats()
public int getCount()
public double getMean()
public double getVariance()
public double getStdDev()
public long getMin()
public long getMax()
public long getTotalTime()
public double[] getPercentileValues()
StatsConfig
for how to request different
percentileValues. Note that for efficiency reasons we return the actual array of
computed values.
Users must NOT modify this array.public double[] getPercentiles()