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 by markStart(). Measuring is stopped by markEnd(). This class in
particularly takes care of the case, when update() is called when some measurement
started but has not yet finished. For example even if next markEnd() call is expected to
happen in a couple of hours, the returned value will account for this ongoing measurement.| Modifier and Type | Class and Description |
|---|---|
static interface |
TimerGauge.StartStopListener
Listens for
markStart() and markEnd() events. |
| Constructor and Description |
|---|
TimerGauge() |
TimerGauge(org.apache.flink.util.clock.Clock clock) |
TimerGauge(org.apache.flink.util.clock.Clock clock,
int timeSpanInSeconds) |
TimerGauge(int timeSpanInSeconds) |
| Modifier and Type | Method and 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() |
public TimerGauge()
public TimerGauge(int timeSpanInSeconds)
public TimerGauge(org.apache.flink.util.clock.Clock clock)
public TimerGauge(org.apache.flink.util.clock.Clock clock,
int timeSpanInSeconds)
public void registerListener(TimerGauge.StartStopListener listener)
public void unregisterListener(TimerGauge.StartStopListener listener)
public void markStart()
public void markEnd()
public void update()
update in interface org.apache.flink.metrics.Viewpublic Long getValue()
getValue in interface org.apache.flink.metrics.Gauge<Long>public long getMaxSingleMeasurement()
public long getAccumulatedCount()
@VisibleForTesting public long getCount()
@VisibleForTesting public boolean isMeasuring()
Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.