Package org.apache.iceberg.metrics
Class DefaultTimer
- java.lang.Object
 - 
- org.apache.iceberg.metrics.DefaultTimer
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface org.apache.iceberg.metrics.Timer
Timer.Timed 
 - 
 
- 
Constructor Summary
Constructors Constructor Description DefaultTimer(java.util.concurrent.TimeUnit timeUnit) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcount()The number of timesTimer.time(Duration)was called.voidrecord(long amount, java.util.concurrent.TimeUnit unit)Records a custom amount in the given time unit.Timer.Timedstart()Starts the timer and returns aTimer.Timedinstance.voidtime(java.lang.Runnable runnable)Executes and measures the givenRunnableinstance.<T> Ttime(java.util.function.Supplier<T> supplier)Gets the result from the givenSupplierand measures its execution time.<T> TtimeCallable(java.util.concurrent.Callable<T> callable)Executes and measures the givenCallableand returns its result.java.lang.StringtoString()java.time.DurationtotalDuration()The total duration that was recorded.java.util.concurrent.TimeUnitunit()TheTimeUnitof the timer. 
 - 
 
- 
- 
Method Detail
- 
count
public long count()
Description copied from interface:TimerThe number of timesTimer.time(Duration)was called.- Specified by:
 countin interfaceTimer- Returns:
 - The number of times 
Timer.time(Duration)was called. 
 
- 
totalDuration
public java.time.Duration totalDuration()
Description copied from interface:TimerThe total duration that was recorded.- Specified by:
 totalDurationin interfaceTimer- Returns:
 - The total duration that was recorded.
 
 
- 
start
public Timer.Timed start()
Description copied from interface:TimerStarts the timer and returns aTimer.Timedinstance. CallTimer.Timed.stop()to complete the timing.- Specified by:
 startin interfaceTimer- Returns:
 - A 
Timer.Timedinstance with the start time recorded. 
 
- 
record
public void record(long amount, java.util.concurrent.TimeUnit unit)Description copied from interface:TimerRecords a custom amount in the given time unit. 
- 
time
public <T> T time(java.util.function.Supplier<T> supplier)
Description copied from interface:TimerGets the result from the givenSupplierand measures its execution time. 
- 
timeCallable
public <T> T timeCallable(java.util.concurrent.Callable<T> callable) throws java.lang.ExceptionDescription copied from interface:TimerExecutes and measures the givenCallableand returns its result.- Specified by:
 timeCallablein interfaceTimer- Type Parameters:
 T- The type of theCallable- Parameters:
 callable- TheCallableto execute and measure.- Returns:
 - The result of the underlying 
Callable. - Throws:
 java.lang.Exception- In case theCallablefails.
 
- 
time
public void time(java.lang.Runnable runnable)
Description copied from interface:TimerExecutes and measures the givenRunnableinstance. 
- 
unit
public java.util.concurrent.TimeUnit unit()
Description copied from interface:TimerTheTimeUnitof the timer. 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
 - 
 
 -