Class Stopwatch

java.lang.Object
cz.fidentis.analyst.gui.task.batch.Stopwatch

public class Stopwatch extends Object
Stopwatch.
  • Constructor Details

    • Stopwatch

      public Stopwatch(String label)
      Constructor.
      Parameters:
      label - label used for printing the time. Can be null
  • Method Details

    • start

      public void start()
      Starts measuring a time span.
    • stop

      public long stop()
      Stops the time span. Span is added to total measured time and also returned.
      Returns:
      span duration in milliseconds
    • getTotalTime

      public long getTotalTime()
      Returns the sum of time spans measured so far. Call the stop() first to include the last span as well.
      Returns:
      total measured time in milliseconds
    • getDuration

      public Duration getDuration()
      The same as getTotalTime(), but the time is returned as Duration
      Returns:
      total measured time as Duration
    • reset

      public void reset()
      Rests the stopwatch, i.e., clears the all previous time measurements.
    • toString

      public String toString()
      Overrides:
      toString in class Object