Class Timer


  • public class Timer
    extends java.lang.Object
    A Timer of operations
    • Constructor Summary

      Constructors 
      Constructor Description
      Timer()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long endTimer()
      Stop timing and return the elapsed time in milliseconds
      long getTimeInterval()
      Read an elapsed timer
      long read()
      Read the timer - either the instantanious value (if running) or elapsed time (if finished).
      long readTimer()
      Read a running timer
      void startTimer()  
      static long time​(java.lang.Runnable action)
      Time an operation.
      static java.lang.String timeStr​(long timeInterval)
      Helper function to format milliseconds as "%.3f" seconds
      • Methods inherited from class java.lang.Object

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

      • Timer

        public Timer()
    • Method Detail

      • startTimer

        public void startTimer()
      • endTimer

        public long endTimer()
        Stop timing and return the elapsed time in milliseconds
      • read

        public long read()
        Read the timer - either the instantanious value (if running) or elapsed time (if finished).
      • readTimer

        public long readTimer()
        Read a running timer
      • getTimeInterval

        public long getTimeInterval()
        Read an elapsed timer
      • timeStr

        public static java.lang.String timeStr​(long timeInterval)
        Helper function to format milliseconds as "%.3f" seconds
      • time

        public static long time​(java.lang.Runnable action)
        Time an operation. Return the elapsed time in milliseconds.