public class RollingWindowAverage extends Object
This class is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
static int |
MILLIS
Helpful constant for one millisecond.
|
static int |
MINUTE
Helpful constant for one minute.
|
static int |
SECOND
Helpful constant for one second.
|
| Constructor and Description |
|---|
RollingWindowAverage(long windowSizeMillis,
long bucketSizeMillis) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(long timestamp,
long value)
Adds a new entry.
|
double |
getCurrentAverage() |
long |
getUpdatesInWindow()
Returns the number of updates kept in the rolling window's scope.
|
long |
getWindowSizeMillis()
Returns the size of the rolling window.
|
public static final int MILLIS
public static final int SECOND
public static final int MINUTE
public RollingWindowAverage(long windowSizeMillis,
long bucketSizeMillis)
public final void add(long timestamp,
long value)
public final double getCurrentAverage()
public final long getUpdatesInWindow()
public final long getWindowSizeMillis()