Class Timing


  • public class Timing
    extends java.lang.Object
    A class for timing things. Originally inspired by the Timing class in the Stanford NLP cade, but completely rewritten.

    Created: Dec 30, 2004

    Version:
    $Id: Timing.java,v 1.1 2007/10/22 21:37:40 mccallum Exp $
    Author:
      • Constructor Summary

        Constructors 
        Constructor Description
        Timing()  
      • Method Summary

        All Methods Instance Methods Concrete Methods 
        Modifier and Type Method Description
        long elapsedTime()
        Returns how much time as passed since Object creation, or the most recent call to tick().
        long report​(java.lang.String msg)
        Like tick(), but doesn't reset the counter.
        long tick​(java.lang.String msg)
        Print to System.out how much time has passed, resetting this Timing's start time to the current time.
        long totalElapsedTime()
        Returns the number of milliseconds since this object was created.
        • Methods inherited from class java.lang.Object

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

      • Timing

        public Timing()
    • Method Detail

      • tick

        public long tick​(java.lang.String msg)
        Print to System.out how much time has passed, resetting this Timing's start time to the current time. Time is measured from the most recent tick call, or when this object was created.
        Parameters:
        msg - Prefix of string printed with time
        Returns:
        Number of elapsed milliseconds from tick (or start)
      • elapsedTime

        public long elapsedTime()
        Returns how much time as passed since Object creation, or the most recent call to tick().
        Returns:
        Number of elapsed milliseconds
      • totalElapsedTime

        public long totalElapsedTime()
        Returns the number of milliseconds since this object was created. Ignores previous calls to tick, unlike elapsedTime and tick.
      • report

        public long report​(java.lang.String msg)
        Like tick(), but doesn't reset the counter.