Class EWMA

  • All Implemented Interfaces:
    LoadAverage

    public final class EWMA
    extends java.lang.Object
    implements LoadAverage
    Copied from dropwizard metrics library 4.0.3
    • Constructor Summary

      Constructors 
      Constructor Description
      EWMA​(double alpha, long interval, java.util.concurrent.TimeUnit intervalUnit)
      Create a new EWMA with a specific smoothing constant.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double rate​(java.util.concurrent.TimeUnit rateUnit)
      Returns the rate in the given units of time.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EWMA

        public EWMA​(double alpha,
                    long interval,
                    java.util.concurrent.TimeUnit intervalUnit)
        Create a new EWMA with a specific smoothing constant.
        Parameters:
        alpha - the smoothing constant
        interval - the expected tick interval
        intervalUnit - the time unit of the tick interval
    • Method Detail

      • update

        public final void update​(long n)
        Description copied from interface: LoadAverage
        Update the moving average with a new value.
        Specified by:
        update in interface LoadAverage
        Parameters:
        n - the new value
      • tick

        public final void tick()
        Description copied from interface: LoadAverage
        Mark the passage of time and decay the current rate accordingly.
        Specified by:
        tick in interface LoadAverage
      • rate

        public final double rate​(java.util.concurrent.TimeUnit rateUnit)
        Description copied from interface: LoadAverage
        Returns the rate in the given units of time.
        Specified by:
        rate in interface LoadAverage
        Parameters:
        rateUnit - the unit of time
        Returns:
        the rate