Class Stopwatch

java.lang.Object
dev.comfast.util.time.Stopwatch

public class Stopwatch extends Object

Class for time measurements.

Start measurement === Constructor call time

Every call time() creates measurement with the same start time

  • Constructor Details

    • Stopwatch

      public Stopwatch()
    • Stopwatch

      public Stopwatch(long startTimestamp, long startTimeNs)
  • Method Details

    • measure

      public static StopwatchTime measure(Runnable measuredFunction)
      Measure time of running given function
    • time

      public StopwatchTime time()
      Can be used multiple times to get intermediate times.
      Returns:
      current stopwatch time