patterntesting.runtime.log
Class LogWatch

Package class diagram package LogWatch
java.lang.Object
  extended by org.apache.commons.lang.time.StopWatch
      extended by patterntesting.runtime.log.LogWatch

public final class LogWatch
extends org.apache.commons.lang.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:
1.4.1 (17.03.2014)
Version:
$Revision: 1.6 $
Author:
oliver

Constructor Summary
LogWatch()
          Instantiates a new log watch.
 
Method Summary
 long getElapsedTime()
          Gets the elapsed time from the start call.
 long getNanoTime()
          Deprecated. use getTimeInNanos()
 double getTimeInMillis()
          Gets the elapsed time from the start call in milli seconds.
 long getTimeInNanos()
          Gets the elapsed time from the start call in nano seconds.
 void reset()
          Reset.
 void start()
          Start.
 void stop()
          Stop.
 String toString()
          To string.
 
Methods inherited from class org.apache.commons.lang.time.StopWatch
getSplitTime, getStartTime, getTime, resume, split, suspend, toSplitString, unsplit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogWatch

public LogWatch()
Instantiates a new log watch.

Method Detail

start

public void start()
Start.

Overrides:
start in class org.apache.commons.lang.time.StopWatch
See Also:
StopWatch.start()

stop

public void stop()
Stop.

Overrides:
stop in class org.apache.commons.lang.time.StopWatch
See Also:
StopWatch.stop()

reset

public void reset()
Reset.

Overrides:
reset in class org.apache.commons.lang.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. use getTimeInNanos()

Gets the elapsed time from the start call in nano seconds.

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.lang.time.StopWatch
Returns:
the string
See Also:
Object.toString()


Copyright © 2002–2014 PatternTesting Team. All rights reserved.