Package org.apache.iceberg.metrics
Interface Timer
- All Known Implementing Classes:
- DefaultTimer
public interface Timer
Generalized Timer interface for creating telemetry related instances for measuring duration of
 operations.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA timing sample that carries internal state about the Timer's start position.
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionlongcount()The number of timestime(Duration)was called.default booleanisNoop()Determines whether this timer is a NOOP timer.voidRecords a custom amount in the given time unit.start()Starts the timer and returns aTimer.Timedinstance.voidExecutes and measures the givenRunnableinstance.default voidThe duration to record<T> TGets the result from the givenSupplierand measures its execution time.<T> TtimeCallable(Callable<T> callable) Executes and measures the givenCallableand returns its result.The total duration that was recorded.default TimeUnitunit()TheTimeUnitof the timer.
- 
Field Details- 
NOOP
 
- 
- 
Method Details- 
countlong count()The number of timestime(Duration)was called.- Returns:
- The number of times time(Duration)was called.
 
- 
totalDurationDuration totalDuration()The total duration that was recorded.- Returns:
- The total duration that was recorded.
 
- 
startTimer.Timed start()Starts the timer and returns aTimer.Timedinstance. CallTimer.Timed.stop()to complete the timing.- Returns:
- A Timer.Timedinstance with the start time recorded.
 
- 
unitTheTimeUnitof the timer.- Returns:
- The TimeUnitof the timer.
 
- 
recordRecords a custom amount in the given time unit.- Parameters:
- amount- The amount to record
- unit- The time unit of the amount
 
- 
timeThe duration to record- Parameters:
- duration- The duration to record
 
- 
timeExecutes and measures the givenRunnableinstance.- Parameters:
- runnable- The- Runnableto execute and measure.
 
- 
timeCallableExecutes and measures the givenCallableand returns its result.
- 
timeGets the result from the givenSupplierand measures its execution time.
- 
isNoopdefault boolean isNoop()Determines whether this timer is a NOOP timer.- Returns:
- Whether this timer is a NOOP timer.
 
 
-