Class IntervalTaskTimer

java.lang.Object
org.deltava.util.TaskTimer
org.deltava.util.IntervalTaskTimer

public class IntervalTaskTimer extends TaskTimer
A Task Timer that allows multiple intervals to be recorded for different steps in an operation.
Since:
11.1
Version:
11.1
Author:
Luke
  • Constructor Details

    • IntervalTaskTimer

      public IntervalTaskTimer()
      Creates and starts the timer.
  • Method Details

    • start

      public void start()
      Starts the timer. This will also create a marker called "start" with the start time.
      Overrides:
      start in class TaskTimer
    • stop

      public long stop()
      End the timer. This will also create a marker called "end" with the end time.
      Overrides:
      stop in class TaskTimer
      Returns:
      the execution time in milliseconds
    • mark

      public long mark(String name)
      Marks an interval without stopping the timer. If a marker name is reused, the previous value will be overwritten.
      Parameters:
      name - the interval name
      Returns:
      the current execution time, in nanoseconds
    • getMarkerNames

      public Collection<String> getMarkerNames()
      Returns the marker names.
      Returns:
      a Collection of marker names
    • getInterval

      public long getInterval(String name)
      Returns the exectution time for a given marker.
      Parameters:
      name - the marker name
      Returns:
      the execution time in milliseconds, or -1 if the marker does not exist
    • toString

      public String toString()
      Overrides:
      toString in class TaskTimer