Class StopWatch

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long elapsedTime()
      Time elapsed between start and stop, in nanoseconds.
      java.lang.String getName()
      All time instruments are named entities.
      TimeInstrumentStatus getStatus()  
      void log()
      If the time instrument has an associated logger, then log information about this time instrument.
      void print()
      Print information about this time instrument on the console.
      void start​(java.lang.String name)
      Start this time instrument.
      TimeInstrument stop()
      Stop this time instrument.
      StopWatch stop​(long stopTime)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        private java.lang.String name
      • startTime

        private long startTime
      • stopTime

        private long stopTime
    • Constructor Detail

      • StopWatch

        public StopWatch​(java.lang.String name)
      • StopWatch

        StopWatch​(StopWatch original)
    • Method Detail

      • start

        public void start​(java.lang.String name)
        Description copied from interface: TimeInstrument
        Start this time instrument.
        Specified by:
        start in interface TimeInstrument
      • getName

        public java.lang.String getName()
        Description copied from interface: TimeInstrument
        All time instruments are named entities.
        Specified by:
        getName in interface TimeInstrument
        Returns:
        the name of this instrument
      • stop

        public StopWatch stop​(long stopTime)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • elapsedTime

        public final long elapsedTime()
        Description copied from interface: TimeInstrument
        Time elapsed between start and stop, in nanoseconds.
        Specified by:
        elapsedTime in interface TimeInstrument
        Returns:
        time elapsed in nanoseconds
      • print

        public void print()
        Description copied from interface: TimeInstrument
        Print information about this time instrument on the console.
        Specified by:
        print in interface TimeInstrument
      • log

        public void log()
        Description copied from interface: TimeInstrument
        If the time instrument has an associated logger, then log information about this time instrument. Note that StopWatch instances cannot log while Profiler instances can.
        Specified by:
        log in interface TimeInstrument