public class EWMA
extends java.lang.Object
Constructor and Description |
---|
EWMA(double alpha,
long interval,
java.util.concurrent.TimeUnit intervalUnit)
Create a new EWMA with a specific smoothing constant.
|
Modifier and Type | Method and Description |
---|---|
static EWMA |
fifteenMinuteEWMA()
Creates a new EWMA which is equivalent to the UNIX fifteen minute load average and which
expects to be ticked every 5 seconds.
|
static EWMA |
fiveMinuteEWMA()
Creates a new EWMA which is equivalent to the UNIX five minute load average and which expects
to be ticked every 5 seconds.
|
double |
getRate(java.util.concurrent.TimeUnit rateUnit)
Returns the rate in the given units of time.
|
static EWMA |
oneMinuteEWMA()
Creates a new EWMA which is equivalent to the UNIX one minute load average and which expects
to be ticked every 5 seconds.
|
void |
tick()
Mark the passage of time and decay the current rate accordingly.
|
void |
update(long n)
Update the moving average with a new value.
|
public EWMA(double alpha, long interval, java.util.concurrent.TimeUnit intervalUnit)
alpha
- the smoothing constantinterval
- the expected tick intervalintervalUnit
- the time unit of the tick intervalpublic static EWMA oneMinuteEWMA()
public static EWMA fiveMinuteEWMA()
public static EWMA fifteenMinuteEWMA()
public void update(long n)
n
- the new valuepublic void tick()
public double getRate(java.util.concurrent.TimeUnit rateUnit)
rateUnit
- the unit of time"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"