Class Stopwatch


  • public class Stopwatch
    extends java.lang.Object
    This stopwatch is always running. It start as soon as you create the instance.
    • Field Detail

      • myStart

        private long myStart
    • Constructor Detail

      • Stopwatch

        public Stopwatch()
    • Method Detail

      • meassure

        public static <T> Stopwatch.TimedResult<T> meassure​(java.util.concurrent.Callable<T> task)
      • meassure

        public static CalendarDateDuration meassure​(java.lang.Runnable task)
        Meassure task duration using this class' stopwatch functionality.
        Parameters:
        task - The task to meassure
        Returns:
        The meassured duration
      • countMillis

        public long countMillis()
      • countNanos

        public long countNanos()
      • isLessThanMillis

        public boolean isLessThanMillis​(long millis)
      • isLessThanNanos

        public boolean isLessThanNanos​(long nanos)
      • isMoreThanMillis

        public boolean isMoreThanMillis​(long millis)
      • isMoreThanNanos

        public boolean isMoreThanNanos​(long nanos)
      • reset

        public void reset()
        Reset the start-instant
      • reset

        public long reset​(CalendarDateUnit unit)
        Will reset the start-instant and return duration since it was last reset in the specified unit.
      • stop

        public CalendarDateDuration stop()
        This method can be called repeatedly without resetting (doesn't actually stop the timing process)
        Returns:
        The duration since instantiation or reset.