Package org.apache.iceberg.metrics
Class DefaultTimer
java.lang.Object
org.apache.iceberg.metrics.DefaultTimer
- All Implemented Interfaces:
Timer
A default
Timer
implementation that uses a Stopwatch
instance internally to
measure time.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.iceberg.metrics.Timer
Timer.Timed
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
count()
The number of timesTimer.time(Duration)
was called.void
Records a custom amount in the given time unit.start()
Starts the timer and returns aTimer.Timed
instance.void
Executes and measures the givenRunnable
instance.<T> T
Gets the result from the givenSupplier
and measures its execution time.<T> T
timeCallable
(Callable<T> callable) Executes and measures the givenCallable
and returns its result.toString()
The total duration that was recorded.unit()
TheTimeUnit
of the timer.
-
Constructor Details
-
DefaultTimer
-
-
Method Details
-
count
public long count()Description copied from interface:Timer
The number of timesTimer.time(Duration)
was called.- Specified by:
count
in interfaceTimer
- Returns:
- The number of times
Timer.time(Duration)
was called.
-
totalDuration
Description copied from interface:Timer
The total duration that was recorded.- Specified by:
totalDuration
in interfaceTimer
- Returns:
- The total duration that was recorded.
-
start
Description copied from interface:Timer
Starts the timer and returns aTimer.Timed
instance. CallTimer.Timed.stop()
to complete the timing.- Specified by:
start
in interfaceTimer
- Returns:
- A
Timer.Timed
instance with the start time recorded.
-
record
Description copied from interface:Timer
Records a custom amount in the given time unit. -
time
Description copied from interface:Timer
Gets the result from the givenSupplier
and measures its execution time. -
timeCallable
Description copied from interface:Timer
Executes and measures the givenCallable
and returns its result. -
time
Description copied from interface:Timer
Executes and measures the givenRunnable
instance. -
unit
Description copied from interface:Timer
TheTimeUnit
of the timer. -
toString
-