Documentation of 'cern.colt.Timer' Java class
Timer
cern.colt

Class Timer



  • public class Timer
    extends java.lang.Object
    A handy stopwatch for benchmarking. Like a real stop watch used on ancient running tracks you can start the watch, stop it, start it again, stop it again, display the elapsed time and reset the watch.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Timer()
      Constructs a new timer, initially not started.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Timer display()
      Prints the elapsed time on System.out
      double elapsedTime()
      Same as seconds().
      double millis()
      Returns the elapsed time in milli seconds; does not stop the timer, if started.
      Timer minus(Timer other)
      T = this - other; Constructs and returns a new timer which is the difference of the receiver and the other timer.
      double minutes()
      Returns the elapsed time in minutes; does not stop the timer, if started.
      long nanos()
      Returns the elapsed time in nano seconds; does not stop the timer, if started.
      Timer plus(Timer other)
      T = this + other; Constructs and returns a new timer which is the sum of the receiver and the other timer.
      Timer reset()
      Resets the timer.
      double seconds()
      Returns the elapsed time in seconds; does not stop the timer, if started.
      Timer start()
      Starts the timer.
      Timer stop()
      Stops the timer.
      static void test(int size)
      Shows how to use a timer in convenient ways.
      java.lang.String toString()
      Returns a String representation of the receiver.
      • Methods inherited from class java.lang.Object

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

      • Timer

        public Timer()
        Constructs a new timer, initially not started. Use start() to start the timer.
    • Method Detail

      • display

        public Timer display()
        Prints the elapsed time on System.out
        Returns:
        this (for convenience only).
      • elapsedTime

        public double elapsedTime()
        Same as seconds().
      • millis

        public double millis()
        Returns the elapsed time in milli seconds; does not stop the timer, if started.
      • nanos

        public long nanos()
        Returns the elapsed time in nano seconds; does not stop the timer, if started.
      • minus

        public Timer minus(Timer other)
        T = this - other; Constructs and returns a new timer which is the difference of the receiver and the other timer. The new timer is not started.
        Parameters:
        other - the timer to subtract.
        Returns:
        a new timer.
      • minutes

        public double minutes()
        Returns the elapsed time in minutes; does not stop the timer, if started.
      • plus

        public Timer plus(Timer other)
        T = this + other; Constructs and returns a new timer which is the sum of the receiver and the other timer. The new timer is not started.
        Parameters:
        other - the timer to add.
        Returns:
        a new timer.
      • reset

        public Timer reset()
        Resets the timer.
        Returns:
        this (for convenience only).
      • seconds

        public double seconds()
        Returns the elapsed time in seconds; does not stop the timer, if started.
      • start

        public Timer start()
        Starts the timer.
        Returns:
        this (for convenience only).
      • stop

        public Timer stop()
        Stops the timer. You can start it again later, if necessary.
        Returns:
        this (for convenience only).
      • test

        public static void test(int size)
        Shows how to use a timer in convenient ways.
      • toString

        public java.lang.String toString()
        Returns a String representation of the receiver.
        Overrides:
        toString in class java.lang.Object

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.