Class Stopwatch


  • public class Stopwatch
    extends java.lang.Object
    Simple stopwatch profiler to benchmark how long code takes to run
    • Constructor Summary

      Constructors 
      Constructor Description
      Stopwatch()
      Begins timing from the moment this object is created.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void lap​(java.lang.String marker)
      Mark down the current time that it took $marker$ to run.
      void print()
      Print the recorded profiler statistics
      void printTimePerAction​(int numActionsExecuted)  
      void reset()
      Reset the Stopwatch so it can be used again.
      • Methods inherited from class java.lang.Object

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

      • Stopwatch

        public Stopwatch()
        Begins timing from the moment this object is created.
    • Method Detail

      • lap

        public void lap​(java.lang.String marker)
        Mark down the current time that it took $marker$ to run.
        Parameters:
        marker - a tag to describe what section of code is being profiled
      • print

        public void print()
        Print the recorded profiler statistics
      • printTimePerAction

        public void printTimePerAction​(int numActionsExecuted)
      • reset

        public void reset()
        Reset the Stopwatch so it can be used again. Begins timing from the moment this method is executed.