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 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.UPDATE_INTERVAL_SECONDS
Constructor and Description |
---|
TimerGauge() |
TimerGauge(Clock clock) |
TimerGauge(Clock clock,
int timeSpanInSeconds) |
TimerGauge(int timeSpanInSeconds) |
Modifier and Type | Method and Description |
---|---|
long |
getAccumulatedCount() |
long |
getCount() |
long |
getMaxSingleMeasurement() |
Long |
getValue()
Calculates and returns the measured value.
|
boolean |
isMeasuring() |
void |
markEnd() |
void |
markStart() |
void |
update()
This method will be called regularly to update the metric.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMetricType
public TimerGauge()
public TimerGauge(int timeSpanInSeconds)
public TimerGauge(Clock clock)
public TimerGauge(Clock clock, int timeSpanInSeconds)
public void markStart()
public void markEnd()
public void update()
View
public Long getValue()
Gauge
public long getMaxSingleMeasurement()
public long getAccumulatedCount()
@VisibleForTesting public long getCount()
@VisibleForTesting public boolean isMeasuring()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.