org.apache.solr.util.stats

## Class EWMA

- java.lang.Object
- - org.apache.solr.util.stats.EWMA

-     public class EWMA
      extends Object

  An exponentially-weighted moving average.
  See Also:
    UNIX Load Average Part 1: How It Works, UNIX Load Average Part 2: Not Your Average Average

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EWMA(double alpha, long interval, TimeUnit intervalUnit)` Create a new EWMA with a specific smoothing constant.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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.

    - ### 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,
                      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

    - #### oneMinuteEWMA

          public 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.
      Returns:
        a one-minute EWMA

    - #### fiveMinuteEWMA

          public 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.
      Returns:
        a five-minute EWMA

    - #### fifteenMinuteEWMA

          public 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.
      Returns:
        a fifteen-minute EWMA

    - #### update

          public void update(long n)

      Update the moving average with a new value.
      Parameters:
        `n` - the new value

    - #### tick

          public void tick()

      Mark the passage of time and decay the current rate accordingly.

    - #### getRate

          public double getRate(TimeUnit rateUnit)

      Returns the rate in the given units of time.
      Parameters:
        `rateUnit` - the unit of time
      Returns:
        the rate

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.