Class Stopwatch

java.lang.Object
org.apache.druid.java.util.common.Stopwatch

public class Stopwatch extends Object
Wrapper over Stopwatch to provide some utility methods such as millisElapsed(), restart(), hasElapsed(Duration).
  • Method Details

    • createStarted

      public static Stopwatch createStarted()
    • createUnstarted

      public static Stopwatch createUnstarted()
    • createStarted

      public static Stopwatch createStarted(com.google.common.base.Ticker ticker)
    • start

      public void start()
    • stop

      public void stop()
    • reset

      public void reset()
    • restart

      public void restart()
      Invokes reset().start() on the underlying Stopwatch.
    • isRunning

      public boolean isRunning()
    • millisElapsed

      public long millisElapsed()
      Returns the milliseconds elapsed on the stopwatch.
    • hasElapsed

      public boolean hasElapsed(org.joda.time.Duration duration)
      Checks if the given duration has already elapsed on the stopwatch.
    • hasNotElapsed

      public boolean hasNotElapsed(org.joda.time.Duration duration)
      Checks that the given duration has not elapsed on the stopwatch. Calling this method is the same as !stopwatch.hasElapsed(duration).