public class EWMA extends Object
Constructor and Description |
---|
EWMA(double alpha,
long interval,
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(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, 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(TimeUnit rateUnit)
rateUnit
- the unit of timeCopyright © 2023 NoraUi. All rights reserved.