Class StopWatch

java.lang.Object
de.hybris.platform.util.StopWatch

public class StopWatch extends Object
Simple timer implementation.

To count the time, a certain process runs, stop it's execution time as follows:
 StopWatch timer = new StopWatch("Stopping my process");
 // run your process
 long elapsedTime = timer.stop();
 // elapsedTime now contains the time, your process run. You may print it to a logger instance
 log.info("process took " + elapsedTime / 1000 + " seconds");
 
  • Constructor Details

    • StopWatch

      public StopWatch(String text)
      Parameters:
      text - An optional name for this StopWatch instance
  • Method Details

    • stop

      public long stop()
      Method stop
    • stop

      public String stop(DecimalFormat df)
    • pause

      public void pause()
    • restart

      public void restart()