public class AtomicRateStatistic extends AbstractRateStatistic
Modifier and Type | Field and Description |
---|---|
private static long |
CALCULATION_FLAG |
private java.util.concurrent.atomic.AtomicLong |
count |
private long |
previousSample |
private float |
rateSample |
private java.util.concurrent.atomic.AtomicLong |
rateSampleTime |
private static int |
SAMPLE_TIME_FLAG_BITS |
private long |
sampleRateMask |
Constructor and Description |
---|
AtomicRateStatistic(long averagePeriod,
java.util.concurrent.TimeUnit unit)
Create an AtomicRateStatistic instance with the given average period.
|
Modifier and Type | Method and Description |
---|---|
void |
event()
Fired to record the occurrence of a monitored event.
|
private void |
finishIncrementTime(long value) |
long |
getCount()
Returns the total number of events that have occurred in the lifetime of this statistic.
|
float |
getRate()
Return the rate of events per unit time.
|
private static long |
getTime() |
private long |
startIncrementTime(long newTime) |
private long |
startReadTime() |
private boolean |
validateTimeRead(long current) |
getRateAveragePeriod, iterateMovingAverage
private static final int SAMPLE_TIME_FLAG_BITS
private static final long CALCULATION_FLAG
private final java.util.concurrent.atomic.AtomicLong count
private final java.util.concurrent.atomic.AtomicLong rateSampleTime
private volatile float rateSample
private volatile long sampleRateMask
private volatile long previousSample
public AtomicRateStatistic(long averagePeriod, java.util.concurrent.TimeUnit unit)
averagePeriod
- average periodunit
- period time unitpublic void event()
public long getCount()
public float getRate()
private long startIncrementTime(long newTime)
private void finishIncrementTime(long value)
private long startReadTime()
private boolean validateTimeRead(long current)
private static long getTime()