public class SampledCounterImpl extends CounterImpl implements SampledCounter
SampledCounter| Modifier and Type | Field and Description |
|---|---|
protected CircularLossyQueue<TimeStampedCounterValue> |
history
The history of this counter
|
protected boolean |
resetOnSample
Should the counter reset on each sample?
|
| Constructor and Description |
|---|
SampledCounterImpl(long intervalInSeconds,
int historySize,
boolean resetOnSample,
long initValue,
boolean sampleNow)
Constructor accepting raw config values.
|
SampledCounterImpl(SampledCounterConfig config)
todo GL how many threads is this creating?
Constructor accepting a
SampledCounterConfig |
| Modifier and Type | Method and Description |
|---|---|
TimeStampedCounterValue[] |
getAllSampleValues()
Returns all samples in history
|
long |
getAndReset()
Returns the current value of the counter and resets it to 0
|
long |
getIntervalMillis()
Returns the sampling thread interval in millis
|
TimeStampedCounterValue |
getMostRecentSample()
Returns the most recent sampled value
|
TimerTask |
getTimerTask()
Returns the timer task for this sampled counter
|
void |
shutdown()
Shutdown this counter
|
decrement, decrement, getAndSet, getValue, increment, increment, setValueprotected final CircularLossyQueue<TimeStampedCounterValue> history
protected final boolean resetOnSample
public SampledCounterImpl(SampledCounterConfig config)
SampledCounterConfigconfig - public SampledCounterImpl(long intervalInSeconds,
int historySize,
boolean resetOnSample,
long initValue,
boolean sampleNow)
intervalInSeconds - sampling interval in secondshistorySize - size of history sampleresetOnSample - true to reset value on sampleinitValue - initial valuesampleNow - true to record smaple immediatelypublic TimeStampedCounterValue getMostRecentSample()
getMostRecentSample in interface SampledCounterpublic TimeStampedCounterValue[] getAllSampleValues()
getAllSampleValues in interface SampledCounterpublic void shutdown()
shutdown in interface SampledCounterpublic TimerTask getTimerTask()
public long getIntervalMillis()
public long getAndReset()
getAndReset in interface SampledCounterCopyright 2001-2021, Terracotta, Inc.