Class Percentile
- java.lang.Object
-
- com.conversantmedia.util.estimation.Percentile
-
public class Percentile extends java.lang.Object
Implementation of "Simulatenous Estimation of Several Persentiles," by Kimmo E. E. Raatikainen This is very useful for profiling the performance of timing characteristics Created by jcairns on 5/28/14.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Percentile.InsufficientSamplesException
Indicates too few measurements have been added to compute the requested estimation
-
Field Summary
Fields Modifier and Type Field Description private float[]
d
private static float[]
DEFAULT_PERCENTILE
private float[]
e
private float[]
f
private boolean
isInitializing
private int
m
private int[]
n
private int
ni
private float[]
q
private float[]
quantiles
-
Constructor Summary
Constructors Constructor Description Percentile()
Percentile(float[] quantiles)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(float x)
Add a measurement to estimateprivate void
addMeasurement(float x)
void
clear()
clear existing samplesfloat[]
getEstimates()
get the estimates based on the last samplefloat
getMax()
float
getMin()
int
getNSamples()
float[]
getQuantiles()
boolean
isReady()
static void
print(java.io.PrintStream out, java.lang.String name, Percentile p)
print a nice histogram of percentiles
-
-
-
Field Detail
-
DEFAULT_PERCENTILE
private static float[] DEFAULT_PERCENTILE
-
quantiles
private final float[] quantiles
-
m
private final int m
-
q
private final float[] q
-
n
private final int[] n
-
f
private final float[] f
-
d
private final float[] d
-
e
private final float[] e
-
isInitializing
private boolean isInitializing
-
ni
private int ni
-
-
Method Detail
-
clear
public void clear()
clear existing samples
-
add
public void add(float x)
Add a measurement to estimate- Parameters:
x
- - the value of the measurement
-
getQuantiles
public float[] getQuantiles()
- Returns:
- float[] - percentiles requested at initialization
-
isReady
public boolean isReady()
- Returns:
- boolean - true if sufficient samples have been seen to form an estimate
-
getNSamples
public int getNSamples()
- Returns:
- int - the number of samples in the estimate
-
getEstimates
public float[] getEstimates() throws Percentile.InsufficientSamplesException
get the estimates based on the last sample- Returns:
- float[]
- Throws:
Percentile.InsufficientSamplesException
- - if no estimate is currently available due to insufficient data
-
getMin
public float getMin()
- Returns:
- float - the minimum sample seen in the distribution
-
getMax
public float getMax()
- Returns:
- float - the maximum sample seen in the distribution
-
addMeasurement
private void addMeasurement(float x)
-
print
public static void print(java.io.PrintStream out, java.lang.String name, Percentile p)
print a nice histogram of percentiles- Parameters:
out
- - output streamname
- - data set namep
- - percentile
-
-