Class StopwatchImpl

  • All Implemented Interfaces:
    com.anaptecs.jeaf.tools.api.performance.Stopwatch

    public class StopwatchImpl
    extends java.lang.Object
    implements com.anaptecs.jeaf.tools.api.performance.Stopwatch
    Class implements a simple stop watch that can be used for performance measurements
    Version:
    JEAF Release 1.3
    Author:
    JEAF Development Team
    • Constructor Summary

      Constructors 
      Constructor Description
      StopwatchImpl​(java.lang.String pName, com.anaptecs.jeaf.tools.api.performance.TimePrecision pPrecision)
      Create new stop watch.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.anaptecs.jeaf.tools.api.performance.StopwatchResult getResult()
      Method returns the result of the measurement.
      boolean isRunning()
      Method checks if the stop watch is still running.
      com.anaptecs.jeaf.tools.api.performance.Stopwatch start()
      Method starts the stop watch.
      com.anaptecs.jeaf.tools.api.performance.Stopwatch start​(long pCount)
      Method starts the stop watch.
      void stop()
      Method stops a running measurement.
      void stop​(long pCount)
      Method stops a running measurement.
      void stopAndTrace()
      Method stops a running measurements and logs the result.
      void stopAndTrace​(long pCount)
      Method stops a running measurements and logs the result.
      void traceResult()
      Method prints the results of a measurement to sysout.
      • Methods inherited from class java.lang.Object

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

      • StopwatchImpl

        public StopwatchImpl​(java.lang.String pName,
                             com.anaptecs.jeaf.tools.api.performance.TimePrecision pPrecision)
        Create new stop watch.
        Parameters:
        pName - Name of the executed measurement. The parameter may be null.
        pPrecision - Precision with which the stop watch should report results. Internally it is always working with nano time precision.
    • Method Detail

      • start

        public com.anaptecs.jeaf.tools.api.performance.Stopwatch start()
        Method starts the stop watch. A stop watch can be started multiple times. When starting the stop watch may be existing results will be deleted.
        Specified by:
        start in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch
      • start

        public com.anaptecs.jeaf.tools.api.performance.Stopwatch start​(long pCount)
        Method starts the stop watch. A stop watch can be started multiple times. When starting the stop watch may be existing results will be deleted.
        Specified by:
        start in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch
        Parameters:
        pName - Name of the executed measurement. The parameter may be null.
        pCount - number of iterations.
      • stop

        public void stop()
        Method stops a running measurement.
        Specified by:
        stop in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch
      • stop

        public void stop​(long pCount)
        Method stops a running measurement.
        Specified by:
        stop in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch
        Parameters:
        pCount - Number of iterations.
      • stopAndTrace

        public void stopAndTrace()
        Method stops a running measurements and logs the result.
        Specified by:
        stopAndTrace in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch
      • stopAndTrace

        public void stopAndTrace​(long pCount)
        Method stops a running measurements and logs the result.
        Specified by:
        stopAndTrace in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch
        Parameters:
        pCount - Number of iterations.
      • isRunning

        public boolean isRunning()
        Method checks if the stop watch is still running.
        Specified by:
        isRunning in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch
        Returns:
        boolean Method returns true if the stop watch is still running and otherwise false.
      • getResult

        public com.anaptecs.jeaf.tools.api.performance.StopwatchResult getResult()
        Method returns the result of the measurement. If the stop watch is not stopped then it will be done by this method.
        Specified by:
        getResult in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch
        Returns:
        StopwatchResult Result of the measurement.
      • traceResult

        public void traceResult()
        Method prints the results of a measurement to sysout.
        Specified by:
        traceResult in interface com.anaptecs.jeaf.tools.api.performance.Stopwatch