|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.netflix.stats.distribution.Distribution
com.netflix.stats.distribution.DataBuffer
public class DataBuffer
A fixed-size data collection buffer that holds a sliding window
of the most recent values added.
The DataBuffer is also a Distribution and so collects
basic statistics about the data added to the buffer.
This statistical data is managed on-the-fly, and reflects all the data
added, if those values that may have been dropped due to buffer overflow.
This class is not synchronized, but can instead managed by a
Lock attached to the DataBuffer (see getLock()).
| Constructor Summary | |
|---|---|
DataBuffer(int capacity)
Creates a new DataBuffer with a given capacity. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears out the distribution, resetting it to its initial state. |
void |
endCollection()
Notifies the buffer that data has just ended. |
int |
getCapacity()
Gets the capacity of the DataBuffer; that is,
the maximum number of values that the DataBuffer can hold. |
java.util.concurrent.locks.Lock |
getLock()
Gets the Lock to use to manage access to the
contents of the DataBuffer. |
double[] |
getPercentiles(double[] percents,
double[] percentiles)
Gets the requested percentile statistics. |
long |
getSampleIntervalMillis()
Gets the length of time over which the data was collected, in milliseconds. |
int |
getSampleSize()
Gets the number of values currently held in the buffer. |
void |
noteValue(double val)
Adds a value to the collected data. |
void |
startCollection()
Notifies the buffer that data is collection is now enabled. |
| Methods inherited from class com.netflix.stats.distribution.Distribution |
|---|
add, getMaximum, getMean, getMinimum, getNumValues, getStdDev, getVariance, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DataBuffer(int capacity)
DataBuffer with a given capacity.
| Method Detail |
|---|
public java.util.concurrent.locks.Lock getLock()
Lock to use to manage access to the
contents of the DataBuffer.
public int getCapacity()
DataBuffer; that is,
the maximum number of values that the DataBuffer can hold.
public long getSampleIntervalMillis()
endCollection()
has been called (and before a subsequent call to startCollection()).
public int getSampleSize()
Distribution.getNumValues()
depending on how the percentile values were computed.
public void clear()
clear in interface DistributionMBeanclear in class Distributionpublic void startCollection()
public void endCollection()
Performance Note:
This method sorts the underlying data buffer,
and so may be slow. It is best to call this at most once
and fetch all percentile values desired, instead of making
a number of repeated calls.
public void noteValue(double val)
The buffer wraps-around if it is full, overwriting the oldest entry with the new value.
noteValue in interface DataCollectornoteValue in class Distribution
public double[] getPercentiles(double[] percents,
double[] percentiles)
percents - array of percentile values to compute,
which must be in the range [0 .. 100]percentiles - array to fill in with the percentile values;
must be the same length as percents
percentiles array
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||