Class Timer

  • All Implemented Interfaces:

    
    public final class Timer
    
                        

    Creates and starts a new timer. The timer will run until stop is called. Timers are automatically registered and can be graphed in aggregate using the graph method.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final String name
    • Constructor Summary

      Constructors 
      Constructor Description
      Timer(String name)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String getName() A name to identify the timer.
      final Unit stop() Stops the timer.
      final Long getDuration() Gets the duration of the timer in milliseconds
      String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • stop

         final Unit stop()

        Stops the timer. Once stopped, a timer cannot be restarted.

      • getDuration

         final Long getDuration()

        Gets the duration of the timer in milliseconds

      • toString

         String toString()
        Returns:

        The timer's name and duration. If the timer has not been stopped, the duration will read as 'Infinity'