Package org.apache.hadoop.metrics2.util
Class SampleStat
java.lang.Object
org.apache.hadoop.metrics2.util.SampleStat
Helper to compute running sample stats
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(double x) Add a sample the running stat.add(long nSamples, double xTotal) Add some sample and a partial sum to the running stat.voidcopyTo(SampleStat other) Copy the values to other (saves object creation and gc.)doublemax()doublemean()doublemin()longvoidreset()doublestddev()toString()doubletotal()doublevariance()
-
Constructor Details
-
SampleStat
public SampleStat()Construct a new running sample stat
-
-
Method Details
-
reset
public void reset() -
copyTo
Copy the values to other (saves object creation and gc.)- Parameters:
other- the destination to hold our values
-
add
Add a sample the running stat.- Parameters:
x- the sample number- Returns:
- self
-
add
Add some sample and a partial sum to the running stat. Note, min/max is not evaluated using this method.- Parameters:
nSamples- number of samplesxTotal- the partial sum- Returns:
- self
-
numSamples
public long numSamples()- Returns:
- the total number of samples
-
total
public double total()- Returns:
- the total of all samples added
-
mean
public double mean()- Returns:
- the arithmetic mean of the samples
-
variance
public double variance()- Returns:
- the variance of the samples
-
stddev
public double stddev()- Returns:
- the standard deviation of the samples
-
min
public double min()- Returns:
- the minimum value of the samples
-
max
public double max()- Returns:
- the maximum value of the samples
-
toString
-