|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.yammer.metrics.stats.ExponentiallyDecayingSample
public class ExponentiallyDecayingSample
An exponentially-decaying random sample of longs. Uses Cormode et al's forward-decaying
priority reservoir sampling method to produce a statistically representative sample,
exponentially biased towards newer entries.
| Constructor Summary | |
|---|---|
ExponentiallyDecayingSample(int reservoirSize,
double alpha)
Creates a new ExponentiallyDecayingSample. |
|
| 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. |
void |
update(long value,
long timestamp)
Adds an old value with a fixed timestamp 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 ExponentiallyDecayingSample(int reservoirSize,
double alpha)
ExponentiallyDecayingSample.
reservoirSize - the number of samples to keep in the sampling reservoiralpha - the exponential decay factor; the higher this is, the more biased the
sample will be towards newer values| 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 value
public void update(long value,
long timestamp)
value - the value to be addedtimestamp - the epoch timestamp of value in secondspublic 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 | |||||||||