Class ValueStats

java.lang.Object
io.activej.jmx.stats.ValueStats
All Implemented Interfaces:
WithInitializer<ValueStats>, JmxRefreshable, JmxRefreshableStats<ValueStats>, JmxStats<ValueStats>, JmxStatsWithReset, JmxStatsWithSmoothingWindow

Counts added values and computes dynamic average using exponential smoothing algorithm

Class is supposed to work in a single thread

  • Method Details

    • createAccumulator

      public static ValueStats createAccumulator()
    • create

      public static ValueStats create(Duration smoothingWindow)
      Creates new ValueStats with specified smoothing window
      Parameters:
      smoothingWindow - in seconds
    • withUnit

      public ValueStats withUnit(String unit)
    • withRate

      public ValueStats withRate(String rateUnit)
    • withRate

      public ValueStats withRate()
    • withHistogram

      public ValueStats withHistogram(JmxHistogram histogram)
    • withHistogram

      public ValueStats withHistogram(int[] histogram)
    • withAbsoluteValues

      public ValueStats withAbsoluteValues(boolean value)
    • withAverageAndDeviation

      public ValueStats withAverageAndDeviation(boolean value)
    • withMinMax

      public ValueStats withMinMax(boolean value)
    • withLastValue

      public ValueStats withLastValue(boolean value)
    • withPrecision

      public ValueStats withPrecision(int precision)
    • withScientificNotation

      public ValueStats withScientificNotation()
    • setHistogram

      public void setHistogram(@Nullable @Nullable JmxHistogram histogram)
    • setHistogram

      public void setHistogram(int[] levels)
    • resetStats

      public void resetStats()
      Resets stats and sets new parameters
      Specified by:
      resetStats in interface JmxStatsWithReset
    • recordValue

      public void recordValue(int value)
      Adds value
    • recordValue

      public void recordValue(double value)
    • refresh

      public void refresh(long timestamp)
      Specified by:
      refresh in interface JmxRefreshable
    • add

      public void add(ValueStats anotherStats)
      Specified by:
      add in interface JmxStats<ValueStats>
    • getLastValue

      public double getLastValue()
      Returns last added value
      Returns:
      last added value
    • getSmoothedAverage

      public double getSmoothedAverage()
      Returns smoothed average of added values
      Returns:
      smoothed average of added values
    • getSmoothedStandardDeviation

      public double getSmoothedStandardDeviation()
      Returns smoothed standard deviation
      Returns:
      smoothed standard deviation
    • getSmoothedMin

      public double getSmoothedMin()
      Returns smoothed minimum of all added values
      Returns:
      smoothed minimum of all added values
    • getSmoothedMax

      public double getSmoothedMax()
      Returns smoothed maximum of all added values
      Returns:
      smoothed maximum of all added values
    • getAbsosuteMin

      public double getAbsosuteMin()
      Returns minimum of all added values
      Returns:
      minimum of all added values
    • getAbsoluteMax

      public double getAbsoluteMax()
      Returns maximum of all added values
      Returns:
      maximum of all added values
    • getAverage

      public double getAverage()
    • getSmoothedRate

      public double getSmoothedRate()
    • getSmoothingWindow

      public Duration getSmoothingWindow()
      Specified by:
      getSmoothingWindow in interface JmxStatsWithSmoothingWindow
    • setSmoothingWindow

      public void setSmoothingWindow(Duration smoothingWindow)
      Specified by:
      setSmoothingWindow in interface JmxStatsWithSmoothingWindow
    • getCount

      public long getCount()
    • getHistogram

      @Nullable public @Nullable List<String> getHistogram()
    • get

      public String get()
    • toString

      public String toString()
      Overrides:
      toString in class Object