public final class ThreadSafeRateTracker extends java.lang.Object implements RateTracker
| Constructor and Description |
|---|
ThreadSafeRateTracker()
Constructor that uses the system time to track the duration of each reporting period.
|
ThreadSafeRateTracker(com.google.common.base.Stopwatch stopwatch)
Constructor that allows passing a specific Stopwatch implementation.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getRateAndResetPeriod()
Get the rate of events per second based on the data since the last call to this method (or object instantiation,
for the first call).
|
void |
track()
Record that the tracked even occurred.
|
public ThreadSafeRateTracker()
public ThreadSafeRateTracker(com.google.common.base.Stopwatch stopwatch)
public void track()
RateTrackertrack in interface RateTrackerpublic double getRateAndResetPeriod()
RateTrackergetRateAndResetPeriod in interface RateTracker