com.codahale.metrics.MovingAverages Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metrics-core Show documentation
Show all versions of metrics-core Show documentation
Metrics is a Java library which gives you unparalleled insight into what your code does in
production. Metrics provides a powerful toolkit of ways to measure the behavior of critical
components in your production environment.
package com.codahale.metrics;
/**
* A triple of moving averages (one-, five-, and fifteen-minute
* moving average) as needed by {@link Meter}.
*
* Included implementations are:
*
* - {@link ExponentialMovingAverages} exponential decaying average similar to the {@code top} Unix command.
*
- {@link SlidingTimeWindowMovingAverages} simple (unweighted) moving average
*
*/
public interface MovingAverages {
/**
* Tick the internal clock of the MovingAverages implementation if needed
* (according to the internal ticking interval)
*/
void tickIfNecessary();
/**
* Update all three moving averages with n events having occurred since the last update.
*
* @param n
*/
void update(long n);
/**
* Returns the one-minute moving average rate
*
* @return the one-minute moving average rate
*/
double getM1Rate();
/**
* Returns the five-minute moving average rate
*
* @return the five-minute moving average rate
*/
double getM5Rate();
/**
* Returns the fifteen-minute moving average rate
*
* @return the fifteen-minute moving average rate
*/
double getM15Rate();
}