Class LogWatch

java.lang.Object
org.apache.commons.lang3.time.StopWatch
clazzfish.monitor.log.LogWatch

public final class LogWatch extends org.apache.commons.lang3.time.StopWatch
The Class LogWatch is a simple stop watch to be able to measure and log code segments which need a little bit longer.
Since:
0.9
Author:
oliver
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new log watch.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Gets the elapsed time from the start call.
    long
    Deprecated.
    double
    Gets the elapsed time from the start call in milli seconds.
    long
    Gets the elapsed time from the start call in nano seconds.
    void
    Reset.
    void
    Start.
    void
    Stop.
    To string.

    Methods inherited from class org.apache.commons.lang3.time.StopWatch

    create, createStarted, formatSplitTime, formatTime, getDuration, getMessage, getSplitDuration, getSplitNanoTime, getSplitTime, getStartInstant, getStartTime, getStopInstant, getStopTime, getTime, getTime, isStarted, isStopped, isSuspended, resume, split, suspend, toSplitString, unsplit

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LogWatch

      public LogWatch()
      Instantiates a new log watch.
  • Method Details

    • start

      public void start()
      Start.
      Overrides:
      start in class org.apache.commons.lang3.time.StopWatch
      See Also:
      • StopWatch.start()
    • stop

      public void stop()
      Stop.
      Overrides:
      stop in class org.apache.commons.lang3.time.StopWatch
      See Also:
      • StopWatch.stop()
    • reset

      public void reset()
      Reset.
      Overrides:
      reset in class org.apache.commons.lang3.time.StopWatch
      See Also:
      • StopWatch.reset()
    • getElapsedTime

      public long getElapsedTime()
      Gets the elapsed time from the start call. This method is a convenience method if you are coming from Perf4J or Speed4J. It also allows us to switch to one of these frameworks if it may be necessary.
      Returns:
      the elapsed time in milliseconds
    • getNanoTime

      @Deprecated public long getNanoTime()
      Deprecated.
      Gets the elapsed time from the start call in nano seconds.
      Overrides:
      getNanoTime in class org.apache.commons.lang3.time.StopWatch
      Returns:
      the nano time
    • getTimeInNanos

      public long getTimeInNanos()
      Gets the elapsed time from the start call in nano seconds.

      This method was called "getNanoTime" before but was now named in "getTimeInNanons" to fit better in the naming schema - there is a similar method getTimeInMillis().

      Returns:
      the nano time
      Since:
      1.4.2
    • getTimeInMillis

      public double getTimeInMillis()
      Gets the elapsed time from the start call in milli seconds.
      Returns:
      the time in millis
      Since:
      1.4.2
    • toString

      public String toString()
      To string.
      Overrides:
      toString in class org.apache.commons.lang3.time.StopWatch
      Returns:
      the string
      See Also: