Class StatMetric
java.lang.Object
com.inductiveautomation.ignition.common.StatMetric
- All Implemented Interfaces:
- Serializable
A StatMetric keeps track of various statistics for one metric. For instance, the Metric
 might be "Requests". The
 statistics that can be kept are:
 
- Total
- Average Duration
- Max Duration
- Min Duration
- Throughput
- See Also:
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructorsConstructorDescriptionCreates a StatMetric that tracks averages in TimeUnit.SECONDS.StatMetric(TimeUnit timeUnit) StatMetric(TimeUnit timeUnit, int nRequiredForAverage) 
- 
Method SummaryModifier and TypeMethodDescriptiondoublegetAvg()The average duration (in seconds) for this metric.longgetHits()Deprecated.doublegetLast()The last duration in seconds.longThe last timestamp that this statmetric was updated.doublegetMax()The maximum duration (in seconds) ever witnessed for this metric.getMetric(StatMetric.Metric metric) doublegetMin()The minimum duration (in seconds) ever witnessed for this metric.doubleThe current throughput for this metric (hits/second), or -1 if the metric is idle.longgetTotal()The total number of occurrences for this metric.static voidprotected voidonSetThroughput(double throughput) Called when the throughput is updated.voidsetTimeBetweenThroughputCalcs(int timeBetweenThroughputCalcs) Set the amount of time that must pass between successive calculations of the throughput.voidsetTimeUnit(TimeUnit timeUnit) toString()voidupdate(long startTime) voidupdate(long startTime, int count) 
- 
Constructor Details- 
StatMetricpublic StatMetric()Creates a StatMetric that tracks averages in TimeUnit.SECONDS.
- 
StatMetric- Parameters:
- timeUnit- TimeUnit to use. Only TimeUnit.MILLISECONDS or TimeUnit.SECONDS.
 
- 
StatMetric- Parameters:
- timeUnit- TimeUnit to use. Only TimeUnit.MILLISECONDS or TimeUnit.SECONDS.
- nRequiredForAverage- The number of calls to update() required to compute an average. Once reached, the average is computed using the last N values.
 
 
- 
- 
Method Details- 
setTimeBetweenThroughputCalcspublic void setTimeBetweenThroughputCalcs(int timeBetweenThroughputCalcs) Set the amount of time that must pass between successive calculations of the throughput.
- 
updatepublic void update(long startTime) 
- 
updatepublic void update(long startTime, int count) 
- 
onSetThroughputprotected void onSetThroughput(double throughput) Called when the throughput is updated. Override if desired.
- 
getAvgpublic double getAvg()The average duration (in seconds) for this metric.
- 
getHitsDeprecated.
- 
getTotalpublic long getTotal()The total number of occurrences for this metric.
- 
getMaxpublic double getMax()The maximum duration (in seconds) ever witnessed for this metric.
- 
getMinpublic double getMin()The minimum duration (in seconds) ever witnessed for this metric.
- 
getLastpublic double getLast()The last duration in seconds.
- 
getThroughputpublic double getThroughput()The current throughput for this metric (hits/second), or -1 if the metric is idle.
- 
getLastUpdatepublic long getLastUpdate()The last timestamp that this statmetric was updated.- Returns:
- The last System.currentTimeMillis() that this StatMetric had update() called on it.
 
- 
getTimeUnit
- 
setTimeUnit
- 
getMetric
- 
toString
- 
main
 
-