This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* An exponentially weighted moving average implementation that decays based on the elapsed time since the last update, | |
* approximating a time windowed moving average. | |
*/ | |
public class MovingAverage { | |
private final long windowNanos; | |
// Mutable state | |
private volatile long lastNanos; | |
private volatile double average; |