|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.yammer.metrics.stats.UniformSample
public class UniformSample
A random sample of a stream of longs. Uses Vitter's Algorithm R to produce a
statistically representative sample.
| Constructor Summary | |
|---|---|
UniformSample(int reservoirSize)
Creates a new UniformSample. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears all recorded values. |
void |
dump(File output)
Writes the values of the sample to the given file. |
int |
size()
Returns the number of values recorded. |
void |
update(long value)
Adds a new recorded value to the sample. |
List<Long> |
values()
Returns a copy of the sample's values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UniformSample(int reservoirSize)
UniformSample.
reservoirSize - the number of samples to keep in the sampling reservoir| Method Detail |
|---|
public void clear()
Sample
clear in interface Samplepublic int size()
Sample
size in interface Samplepublic void update(long value)
Sample
update in interface Samplevalue - a new recorded valuepublic List<Long> values()
Sample
values in interface Sample
public void dump(File output)
throws IOException
Sample
dump in interface Sampleoutput - the file to which the values will be written
IOException - if there is an error writing the values
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||