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 -
Method Summary
Modifier and TypeMethodDescriptionlong
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()
Reset.void
start()
Start.void
stop()
Stop.toString()
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
-
Constructor Details
-
LogWatch
public LogWatch()Instantiates a new log watch.
-
-
Method Details
-
start
public void start()Start.- Overrides:
start
in classorg.apache.commons.lang3.time.StopWatch
- See Also:
-
stop
public void stop()Stop.- Overrides:
stop
in classorg.apache.commons.lang3.time.StopWatch
- See Also:
-
reset
public void reset()Reset.- Overrides:
reset
in classorg.apache.commons.lang3.time.StopWatch
- See Also:
-
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.usegetTimeInNanos()
Gets the elapsed time from the start call in nano seconds.- Overrides:
getNanoTime
in classorg.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
To string.- Overrides:
toString
in classorg.apache.commons.lang3.time.StopWatch
- Returns:
- the string
- See Also:
-
getTimeInNanos()