Package org.apache.flink.runtime.metrics
Class TimerGauge
- java.lang.Object
-
- org.apache.flink.runtime.metrics.TimerGauge
-
- All Implemented Interfaces:
org.apache.flink.metrics.Gauge<Long>
,org.apache.flink.metrics.Metric
,org.apache.flink.metrics.View
public class TimerGauge extends Object implements org.apache.flink.metrics.Gauge<Long>, org.apache.flink.metrics.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.
-
Constructor Summary
Constructors Constructor Description TimerGauge()
TimerGauge(int timeSpanInSeconds)
TimerGauge(org.apache.flink.util.clock.Clock clock)
TimerGauge(org.apache.flink.util.clock.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()
boolean
isMeasuring()
void
markEnd()
void
markStart()
void
registerListener(TimerGauge.StartStopListener listener)
void
unregisterListener(TimerGauge.StartStopListener listener)
void
update()
-
-
-
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()
- Specified by:
update
in interfaceorg.apache.flink.metrics.View
-
getValue
public Long getValue()
- Specified by:
getValue
in interfaceorg.apache.flink.metrics.Gauge<Long>
-
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()
-
-