public class SampledCounter extends Counter implements ISampledCounter
ISampledCounter| Modifier and Type | Field and Description |
|---|---|
protected CircularLossyQueue<TimeStampedCounterValue> |
m_aHistory
The history of this counter
|
protected boolean |
m_bResetOnSample
Should the counter reset on each sample?
|
| Constructor and Description |
|---|
SampledCounter(SampledCounterConfig config)
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() |
TimeStampedCounterValue |
getMostRecentSample()
Returns the most recent sampled value
|
TimerTask |
getTimerTask() |
void |
shutdown()
Shutdown this counter
|
decrement, getAndSet, getValue, increment, increment, setValueprotected final CircularLossyQueue<TimeStampedCounterValue> m_aHistory
protected final boolean m_bResetOnSample
public SampledCounter(@Nonnull SampledCounterConfig config)
SampledCounterConfigconfig - configpublic TimeStampedCounterValue getMostRecentSample()
ISampledCountergetMostRecentSample in interface ISampledCounterpublic TimeStampedCounterValue[] getAllSampleValues()
ISampledCountergetAllSampleValues in interface ISampledCounterpublic void shutdown()
ISampledCountershutdown in interface ISampledCounterpublic TimerTask getTimerTask()
public long getIntervalMillis()
public long getAndReset()
ISampledCountergetAndReset in interface ISampledCounterCopyright © 2016–2021 Philip Helger. All rights reserved.