Class Timer

Object
io.delta.kernel.internal.metrics.Timer

public class Timer extends Object
A timer class for measuring the duration of operations in nanoseconds
  • Constructor Details

    • Timer

      public Timer()
  • Method Details

    • count

      public long count()
      Returns:
      the number of times this timer was used to record a duration.
    • totalDurationNs

      public long totalDurationNs()
      Returns:
      the total duration that was recorded in nanoseconds
    • totalDurationMs

      public long totalDurationMs()
      Returns:
      the total duration that was recorded in milliseconds
    • totalDurationIfRecorded

      public Optional<Long> totalDurationIfRecorded()
      Returns:
      An optional storing the total duration recorded in the timer if the timer has been used to record a duration at least once. If the timer has not been used, returns empty.
    • start

      public Timer.Timed start()
      Starts the timer and returns a Timer.Timed instance. Call Timer.Timed.stop() to complete the timing.
      Returns:
      A Timer.Timed instance with the start time recorded.
    • record

      public void record(long amount)
      Records a custom amount.
      Parameters:
      amount - The amount to record in nanoseconds
    • time

      public <T> T time(Supplier<T> supplier)
    • timeCallable

      public <T> T timeCallable(Callable<T> callable) throws Exception
      Throws:
      Exception
    • timeChecked

      public <T, E extends Exception> T timeChecked(Timer.ThrowingSupplier<T,E> operation) throws E
      Times an operation that can throw a specific checked exception type.
      Throws:
      E
    • time

      public void time(Runnable runnable)
    • toString

      public String toString()
      Overrides:
      toString in class Object