Package com.yahoo.statistics
Class Value
- java.lang.Object
-
- com.yahoo.statistics.Handle
-
- com.yahoo.statistics.Value
-
public class Value extends Handle
A statistical variable, typically representing a sampling of an arbitrarily changing parameter.- Author:
- Steinar Knutsen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Value.Parameters
Parameters for building Value instances.
-
Constructor Summary
Constructors Constructor Description Value(java.lang.String name, Statistics manager, Value.Parameters parameters)
Configure a Value instance fully, no raw config access.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Value
buildValue(java.lang.String name, Statistics manager, Value.Parameters defaults)
Build a Value which should be initialized from config.boolean
equals(java.lang.Object o)
double
get()
Get last value logged, 0 if nothing logged since reset.double
getMax()
Get maximum value logged since last reset.double
getMean()
Get mean value since last reset.double
getMin()
Get minimal value logged since last reset.int
hashCode()
void
put(double x)
Insert x, do all pertinent operations.void
reset()
Set last value logged container to 0, reset histogram and set all counters and derived statistics to 0.void
runHandle()
Dump state to log and reset.java.lang.String
toString()
-
Methods inherited from class com.yahoo.statistics.Handle
cancel, isCancelled, run, runCallback
-
-
-
-
Constructor Detail
-
Value
public Value(java.lang.String name, Statistics manager, Value.Parameters parameters)
Configure a Value instance fully, no raw config access.- Parameters:
name
- tag for loggingmanager
- the statistics manager acquired by injectionparameters
- all the parameters necessary for initializing a Value- Throws:
java.lang.IllegalStateException
- if Parameters.limits exists and is not frozen
-
-
Method Detail
-
buildValue
public static Value buildValue(java.lang.String name, Statistics manager, Value.Parameters defaults)
Build a Value which should be initialized from config.- Parameters:
name
- the name of the event in the logmanager
- the current Statistics manager, acquired by injectiondefaults
- defaults for values not defined by config, this may be null
-
put
public void put(double x)
Insert x, do all pertinent operations. (Update histogram, update insertion count for calculating mean, etc.)
-
getMean
public double getMean()
Get mean value since last reset.
-
getMin
public double getMin()
Get minimal value logged since last reset.
-
getMax
public double getMax()
Get maximum value logged since last reset.
-
get
public double get()
Get last value logged, 0 if nothing logged since reset.
-
reset
public void reset()
Set last value logged container to 0, reset histogram and set all counters and derived statistics to 0.
-
runHandle
public void runHandle()
Dump state to log and reset.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-