Class RestorableMeter

java.lang.Object
org.apache.cassandra.metrics.RestorableMeter

public class RestorableMeter extends 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:
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    long
    The total number of events that have occurred since this object was created.
    double
    Returns the 15-minute rate in terms of events per second.
    void
    Mark the occurrence of an event.
    void
    mark(long n)
    Mark the occurrence of a given number of events.
    double
    Returns the mean rate of events per second since this object was created.
    double
    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 Details

    • 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 Details

    • 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.