Package org.apache.flink.runtime.metrics
Class TimerGauge
- java.lang.Object
-
- org.apache.flink.runtime.metrics.TimerGauge
-
public class TimerGauge extends Object implements Gauge<Long>, View
TimerGauge
measures how much time is spent in a given state, with entry into that state being signaled bymarkStart()
. Measuring is stopped bymarkEnd()
. This class in particularly takes care of the case, whenupdate()
is called when some measurement started but has not yet finished. For example even if nextmarkEnd()
call is expected to happen in a couple of hours, the returned value will account for this ongoing measurement.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TimerGauge.StartStopListener
Listens formarkStart()
andmarkEnd()
events.
-
Field Summary
-
Fields inherited from interface org.apache.flink.metrics.View
UPDATE_INTERVAL_SECONDS
-
-
Constructor Summary
Constructors Constructor Description TimerGauge()
TimerGauge(int timeSpanInSeconds)
TimerGauge(Clock clock)
TimerGauge(Clock clock, int timeSpanInSeconds)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getAccumulatedCount()
long
getCount()
long
getMaxSingleMeasurement()
Long
getValue()
Calculates and returns the measured value.boolean
isMeasuring()
void
markEnd()
void
markStart()
void
registerListener(TimerGauge.StartStopListener listener)
void
unregisterListener(TimerGauge.StartStopListener listener)
void
update()
This method will be called regularly to update the metric.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.metrics.Gauge
getMetricType
-
-
-
-
Method Detail
-
registerListener
public void registerListener(TimerGauge.StartStopListener listener)
-
unregisterListener
public void unregisterListener(TimerGauge.StartStopListener listener)
-
markStart
public void markStart()
-
markEnd
public void markEnd()
-
update
public void update()
Description copied from interface:View
This method will be called regularly to update the metric.
-
getValue
public Long getValue()
Description copied from interface:Gauge
Calculates and returns the measured value.
-
getMaxSingleMeasurement
public long getMaxSingleMeasurement()
- Returns:
- the longest marked period as measured by the given * TimerGauge. For example the longest consecutive back pressured period.
-
getAccumulatedCount
public long getAccumulatedCount()
- Returns:
- the accumulated period by the given * TimerGauge.
-
getCount
@VisibleForTesting public long getCount()
-
isMeasuring
@VisibleForTesting public boolean isMeasuring()
-
-