|
||||||||||
| 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. |
Snapshot |
getSnapshot()
Returns a snapshot of the sample's values. |
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. |
| 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 Snapshot getSnapshot()
Sample
getSnapshot in interface Sample
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||