org.springframework.integration.monitor
Class ExponentialMovingAverageRate
java.lang.Object
org.springframework.integration.monitor.ExponentialMovingAverageRate
public class ExponentialMovingAverageRate
- extends java.lang.Object
Cumulative statistics for an event rate with higher weight given to recent data but without storing any history.
Clients call increment()
when a new event occurs, and then use convenience methods (e.g. getMean()
)
to retrieve estimates of the rate of event arrivals and the statistics of the series. Older values are given
exponentially smaller weight, with a decay factor determined by a duration chosen by the client. The rate measurement
weights decay in two dimensions:
- in time according to the lapse period supplied:
weight = exp((t0-t)/T)
where t0
is the
last measurement time, t
is the current time and T
is the lapse period)
- per measurement according to the lapse window supplied:
weight = exp(-i/L)
where L
is
the lapse window and i
is the sequence number of the measurement.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ExponentialMovingAverageRate
public ExponentialMovingAverageRate(double period,
double lapsePeriod,
int window)
- Parameters:
period
- the period to base the rate measurement (in seconds)lapsePeriod
- the exponential lapse rate for the rate average (in seconds)window
- the exponential lapse window (number of measurements)
reset
public void reset()
increment
public void increment()
- Add a new event to the series.
getCount
public int getCount()
- Returns:
- the number of measurements recorded
getTimeSinceLastMeasurement
public double getTimeSinceLastMeasurement()
- Returns:
- the time in seconds since the last measurement
getMean
public double getMean()
- Returns:
- the mean value
getStandardDeviation
public double getStandardDeviation()
- Returns:
- the approximate standard deviation
getMax
public double getMax()
- Returns:
- the maximum value recorded (not weighted)
getMin
public double getMin()
- Returns:
- the minimum value recorded (not weighted)
getStatistics
public Statistics getStatistics()
- Returns:
- summary statistics (count, mean, standard deviation etc.)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object