SampleStat (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.metrics2.util, class: SampleStat

Package org.apache.hadoop.metrics2.util

# Class SampleStat

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

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

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `SampleStat.MinMax`
  Helper to keep running min/max

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SampleStat()`
  Construct a new running sample stat

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SampleStat`
  `add(double x)`
  Add a sample the running stat.
  `SampleStat`
  `add(long nSamples, double xTotal)`
  Add some sample and a partial sum to the running stat.
  `void`
  `copyTo(SampleStat other)`
  Copy the values to other (saves object creation and gc.)
  `double`
  `max()`
  `double`
  `mean()`
  `double`
  `min()`
  `long`
  `numSamples()`
  `void`
  `reset()`
  `double`
  `stddev()`
  `String`
  `toString()`
  `double`
  `total()`
  `double`
  `variance()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

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