Class RestorableMeter


  • public class RestorableMeter
    extends java.lang.Object
    A meter metric which measures mean throughput as well as fifteen-minute and two-hour exponentially-weighted moving average throughputs. This is based heavily on the Meter and EWMA classes from codahale/yammer metrics.
    See Also:
    EMA
    • Constructor Summary

      Constructors 
      Constructor Description
      RestorableMeter()
      Creates a new, uninitialized RestorableMeter.
      RestorableMeter​(double lastM15Rate, double lastM120Rate)
      Restores a RestorableMeter from the last seen 15m and 2h rates.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long count()
      The total number of events that have occurred since this object was created.
      double fifteenMinuteRate()
      Returns the 15-minute rate in terms of events per second.
      void mark()
      Mark the occurrence of an event.
      void mark​(long n)
      Mark the occurrence of a given number of events.
      double meanRate()
      Returns the mean rate of events per second since this object was created.
      double twoHourRate()
      Returns the two-hour rate in terms of events per second.
      • Methods inherited from class java.lang.Object

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

      • RestorableMeter

        public RestorableMeter()
        Creates a new, uninitialized RestorableMeter.
      • RestorableMeter

        public RestorableMeter​(double lastM15Rate,
                               double lastM120Rate)
        Restores a RestorableMeter from the last seen 15m and 2h rates.
        Parameters:
        lastM15Rate - the last-seen 15m rate, in terms of events per second
        lastM120Rate - the last seen 2h rate, in terms of events per second
    • Method Detail

      • mark

        public void mark()
        Mark the occurrence of an event.
      • mark

        public void mark​(long n)
        Mark the occurrence of a given number of events.
        Parameters:
        n - the number of events
      • fifteenMinuteRate

        public double fifteenMinuteRate()
        Returns the 15-minute rate in terms of events per second. This carries the previous rate when restored.
      • twoHourRate

        public double twoHourRate()
        Returns the two-hour rate in terms of events per second. This carries the previous rate when restored.
      • count

        public long count()
        The total number of events that have occurred since this object was created. Note that the previous count is *not* carried over when a RestorableMeter is restored.
      • meanRate

        public double meanRate()
        Returns the mean rate of events per second since this object was created. Note that the mean rate does *not* carry over when a RestorableMeter is restored, so the mean rate is only a measure since this object was created.