Class LoggingStopwatch


  • public class LoggingStopwatch
    extends java.lang.Object
    A stop watch that prints log messages.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long mark​(java.lang.String msg)
      Convenience method that invokes mark(String, boolean) with true as its second argument.
      long mark​(java.lang.String msg, boolean reset)
      Mark the completion of a task, print the time it took to complete, and optionally restart the stopwatch.
      void start()
      Start the stopwatch.
      • Methods inherited from class java.lang.Object

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

      • LoggingStopwatch

        public LoggingStopwatch()
    • Method Detail

      • start

        public void start()
        Start the stopwatch.
      • mark

        public long mark​(java.lang.String msg,
                         boolean reset)
        Mark the completion of a task, print the time it took to complete, and optionally restart the stopwatch.
        Parameters:
        msg - message to print
        reset - whether to restart the stopwatch
        Returns:
        the elapsed time in milliseconds
      • mark

        public long mark​(java.lang.String msg)
        Convenience method that invokes mark(String, boolean) with true as its second argument.