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 TypeMethodDescriptionlongGets the elapsed time from the start call.longDeprecated.doubleGets the elapsed time from the start call in milli seconds.longGets the elapsed time from the start call in nano seconds.voidreset()Reset.voidstart()Start.voidstop()Stop.toString()To string.Methods inherited from class org.apache.commons.lang3.time.StopWatch
create, createStarted, formatSplitTime, formatTime, get, getDuration, getMessage, getSplitDuration, getSplitNanoTime, getSplitTime, getStartInstant, getStartTime, getStopInstant, getStopTime, getT, getTime, getTime, isStarted, isStopped, isSuspended, resume, run, runT, split, suspend, toSplitString, unsplit
-
Constructor Details
-
LogWatch
public LogWatch()Instantiates a new log watch.
-
-
Method Details
-
start
public void start()Start.- Overrides:
startin classorg.apache.commons.lang3.time.StopWatch- See Also:
-
stop
public void stop()Stop.- Overrides:
stopin classorg.apache.commons.lang3.time.StopWatch- See Also:
-
reset
public void reset()Reset.- Overrides:
resetin 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:
getNanoTimein 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:
toStringin classorg.apache.commons.lang3.time.StopWatch- Returns:
- the string
- See Also:
-
getTimeInNanos()