Package org.apache.camel.util
Class StopWatch
- java.lang.Object
-
- org.apache.camel.util.StopWatch
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static long
elapsedMillisSince(long start)
Deprecated.boolean
isStarted()
Whether the watch is startedvoid
restart()
Starts or restarts the stop watchlong
taken()
Returns the time taken in millis.long
takenAndRestart()
Returns the time taken in millis and restarts the timer.
-
-
-
Method Detail
-
restart
public void restart()
Starts or restarts the stop watch
-
isStarted
public boolean isStarted()
Whether the watch is started
-
taken
public long taken()
Returns the time taken in millis.- Returns:
- time in millis, or 0 if not started yet.
-
takenAndRestart
public long takenAndRestart()
Returns the time taken in millis and restarts the timer.- Returns:
- time in millis, or 0 if not started yet.
-
elapsedMillisSince
@Deprecated public static long elapsedMillisSince(long start)
Deprecated.Utility method to provide the elapsed time using milliseconds since epoch. This serves as an alternative for the former constructor based on a Date argument. This should be used only when converting old code that relies on that constructor as it can provide incorrect measurements in rare circumstances- Parameters:
start
- the timestamp in milliseconds since epoch- Returns:
- the elapsed time in milliseconds
-
-