Package org.glassfish.pfl.tf.timer.spi
Class StatisticsAccumulator
java.lang.Object
org.glassfish.pfl.tf.timer.spi.StatisticsAccumulator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
private double
private long
(package private) double
(package private) double
private Statistics
private String
-
Constructor Summary
ConstructorsConstructorDescriptionStatisticsAccumulator
(String unit) Construct the Statistics Accumulator by providing the unit as a String. -
Method Summary
Modifier and TypeMethodDescriptionvoid
double
average()
void
Clears the samples and starts fresh on new samples.long
count()
getStats()
getValue()
Computes the Standard Statistic Results based on the samples collected so far and provides the complete value as a formatted Stringdouble
max()
double
min()
void
sample
(double value) double
toString()
Users can extend StatisticsAccumulator to provide the complete Stats in the format they prefer, if the default format doesn't suffice.unit()
void
unitTestValidate
(String expectedUnit, double expectedMin, double expectedMax, long expectedSampleCount, double expectedAverage, double expectedStandardDeviation) This is an internal API to test StatisticsAccumulator...
-
Field Details
-
max
private double max -
min
private double min -
sampleSum
double sampleSum -
sampleSquareSum
double sampleSquareSum -
sampleCount
private long sampleCount -
unit
-
stats
-
-
Constructor Details
-
StatisticsAccumulator
Construct the Statistics Accumulator by providing the unit as a String. The examples of units are "Hours", "Minutes", "Seconds", "MilliSeconds", "Micro Seconds" etc.,- Parameters:
unit
- a String representing the units for the samples collected
-
-
Method Details
-
unit
-
count
public long count() -
min
public double min() -
max
public double max() -
average
public double average() -
standardDeviation
public double standardDeviation() -
sample
public void sample(double value) -
getStats
-
augment
-
getValue
Computes the Standard Statistic Results based on the samples collected so far and provides the complete value as a formatted String -
toString
Users can extend StatisticsAccumulator to provide the complete Stats in the format they prefer, if the default format doesn't suffice. -
clearState
public void clearState()Clears the samples and starts fresh on new samples. -
unitTestValidate
public void unitTestValidate(String expectedUnit, double expectedMin, double expectedMax, long expectedSampleCount, double expectedAverage, double expectedStandardDeviation) This is an internal API to test StatisticsAccumulator...
-