Class StatCalculator
-
- All Implemented Interfaces:
public abstract class StatCalculator<T extends Number, Comparable<in T>>This class serves as a way to calculate the median, max, min etc. of a list of values. It is not threadsafe.
-
-
Method Summary
Modifier and Type Method Description doublegetSum()doublegetMean()longgetCount()TgetMin()TgetMax()voidclear()voidaddBytes(long newValue)Add to received bytes voidaddSentBytes(long newValue)Add to sent bytes voidaddAll(StatCalculator<T> calc)TgetMedian()longgetTotalBytes()longgetTotalSentBytes()TgetPercentPoint(float percent)Get the value which %percent% of the values are less than. TgetPercentPoint(double percent)Get the value which %percent% of the values are less than. Map<Number, Array<Number>>getDistribution()Returns the distribution of the values in the list. doublegetStandardDeviation()voidaddValue(T val, long sampleCount)Update the calculator with the value for an aggregated sample. voidaddValue(T val)Add a single value (normally elapsed time) -
-
Method Detail
-
getSum
double getSum()
-
getMean
double getMean()
-
getCount
long getCount()
-
clear
void clear()
-
addBytes
void addBytes(long newValue)
Add to received bytes
- Parameters:
newValue- number of newly received bytes
-
addSentBytes
void addSentBytes(long newValue)
Add to sent bytes
- Parameters:
newValue- number of newly sent bytes
-
addAll
void addAll(StatCalculator<T> calc)
-
getTotalBytes
long getTotalBytes()
-
getTotalSentBytes
long getTotalSentBytes()
-
getPercentPoint
T getPercentPoint(float percent)
Get the value which %percent% of the values are less than. This works just like median (where median represents the 50% point). A typical desire is to see the 90% point - the value that 90% of the data points are below, the remaining 10% are above.
- Parameters:
percent- number representing the wished percent (between0and1.0)- Returns:
number of values less than the percentage
-
getPercentPoint
T getPercentPoint(double percent)
Get the value which %percent% of the values are less than. This works just like median (where median represents the 50% point). A typical desire is to see the 90% point - the value that 90% of the data points are below, the remaining 10% are above.
- Parameters:
percent- number representing the wished percent (between0and1.0)- Returns:
the value which %percent% of the values are less than
-
getDistribution
Map<Number, Array<Number>> getDistribution()
Returns the distribution of the values in the list.
- Returns:
map containing either Integer or Long keys; entries are a Number array containing the key and the [Integer] count. TODO - why is the key value also stored in the entry array? See Bug 53825
-
getStandardDeviation
double getStandardDeviation()
-
addValue
void addValue(T val, long sampleCount)
Update the calculator with the value for an aggregated sample.
- Parameters:
val- the aggregate value, normally the elapsed timesampleCount- the number of samples contributing to the aggregate value
-
-
-
-