Package io.activej.jmx.stats
Class ValueStats
java.lang.Object
io.activej.jmx.stats.ValueStats
- All Implemented Interfaces:
WithInitializer<ValueStats>,JmxRefreshable,JmxRefreshableStats<ValueStats>,JmxStats<ValueStats>,JmxStatsWithReset,JmxStatsWithSmoothingWindow
public final class ValueStats
extends Object
implements JmxRefreshableStats<ValueStats>, JmxStatsWithReset, JmxStatsWithSmoothingWindow, WithInitializer<ValueStats>
Counts added values and computes dynamic average using exponential smoothing algorithm
Class is supposed to work in a single thread
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ValueStats anotherStats) static ValueStatsCreates new ValueStats with specified smoothing windowstatic ValueStatsget()doubleReturns maximum of all added valuesdoubleReturns minimum of all added valuesdoublelonggetCount()doubleReturns last added valuedoubleReturns smoothed average of added valuesdoubleReturns smoothed maximum of all added valuesdoubleReturns smoothed minimum of all added valuesdoubledoubleReturns smoothed standard deviationvoidrecordValue(double value) voidrecordValue(int value) Adds valuevoidrefresh(long timestamp) voidResets stats and sets new parametersvoidsetHistogram(int[] levels) voidsetHistogram(@Nullable JmxHistogram histogram) voidsetSmoothingWindow(Duration smoothingWindow) toString()withAbsoluteValues(boolean value) withAverageAndDeviation(boolean value) withHistogram(int[] histogram) withHistogram(JmxHistogram histogram) withLastValue(boolean value) withMinMax(boolean value) withPrecision(int precision) withRate()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.activej.common.initializer.WithInitializer
withInitializer
-
Method Details
-
createAccumulator
-
create
Creates new ValueStats with specified smoothing window- Parameters:
smoothingWindow- in seconds
-
withUnit
-
withRate
-
withRate
-
withHistogram
-
withHistogram
-
withAbsoluteValues
-
withAverageAndDeviation
-
withMinMax
-
withLastValue
-
withPrecision
-
withScientificNotation
-
setHistogram
-
setHistogram
public void setHistogram(int[] levels) -
resetStats
public void resetStats()Resets stats and sets new parameters- Specified by:
resetStatsin interfaceJmxStatsWithReset
-
recordValue
public void recordValue(int value) Adds value -
recordValue
public void recordValue(double value) -
refresh
public void refresh(long timestamp) - Specified by:
refreshin interfaceJmxRefreshable
-
add
- Specified by:
addin interfaceJmxStats<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
- Specified by:
getSmoothingWindowin interfaceJmxStatsWithSmoothingWindow
-
setSmoothingWindow
- Specified by:
setSmoothingWindowin interfaceJmxStatsWithSmoothingWindow
-
getCount
public long getCount() -
getHistogram
-
get
-
toString
-