Class SampleStat

java.lang.Object
org.apache.hadoop.metrics2.util.SampleStat

@Private public class SampleStat extends Object
Helper to compute running sample stats
  • Constructor Details

    • SampleStat

      public SampleStat()
      Construct a new running sample stat
  • Method Details

    • reset

      public void reset()
    • copyTo

      public void copyTo(SampleStat other)
      Copy the values to other (saves object creation and gc.)
      Parameters:
      other - the destination to hold our values
    • add

      public SampleStat add(double x)
      Add a sample the running stat.
      Parameters:
      x - the sample number
      Returns:
      self
    • add

      public SampleStat add(long nSamples, double xTotal)
      Add some sample and a partial sum to the running stat. Note, min/max is not evaluated using this method.
      Parameters:
      nSamples - number of samples
      xTotal - the partial sum
      Returns:
      self
    • numSamples

      public long numSamples()
      Returns:
      the total number of samples
    • total

      public double total()
      Returns:
      the total of all samples added
    • mean

      public double mean()
      Returns:
      the arithmetic mean of the samples
    • variance

      public double variance()
      Returns:
      the variance of the samples
    • stddev

      public double stddev()
      Returns:
      the standard deviation of the samples
    • min

      public double min()
      Returns:
      the minimum value of the samples
    • max

      public double max()
      Returns:
      the maximum value of the samples
    • toString

      public String toString()
      Overrides:
      toString in class Object