Class Stopwatch
java.lang.Object
org.ojalgo.type.Stopwatch
This stopwatch is always running. It start as soon as you create the instance.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonglongbooleanisLessThan(CalendarDateDuration duration) booleanisLessThanMillis(long millis) booleanisLessThanNanos(long nanos) booleanisMoreThan(CalendarDateDuration duration) booleanisMoreThanMillis(long millis) booleanisMoreThanNanos(long nanos) static CalendarDateDurationMeassure task duration using this class' stopwatch functionality.static CalendarDateDurationmeassure(Runnable task, CalendarDateUnit unit) static <T> Stopwatch.TimedResult<T> static <T> Stopwatch.TimedResult<T> meassure(Callable<T> task, CalendarDateUnit unit) voidreset()Reset the start-instantlongreset(CalendarDateUnit unit) Will reset the start-instant and return duration since it was last reset in the specified unit.restart()restart(CalendarDateUnit unit) stop()This method can be called repeatedly without resetting (doesn't actually stop the timing process)stop(CalendarDateUnit unit)
-
Field Details
-
myStart
private long myStart
-
-
Constructor Details
-
Stopwatch
public Stopwatch()
-
-
Method Details
-
meassure
-
meassure
-
meassure
Meassure task duration using this class' stopwatch functionality.- Parameters:
task- The task to meassure- Returns:
- The meassured duration
-
meassure
-
countMillis
public long countMillis() -
countNanos
public long countNanos() -
isLessThan
-
isLessThanMillis
public boolean isLessThanMillis(long millis) -
isLessThanNanos
public boolean isLessThanNanos(long nanos) -
isMoreThan
-
isMoreThanMillis
public boolean isMoreThanMillis(long millis) -
isMoreThanNanos
public boolean isMoreThanNanos(long nanos) -
reset
public void reset()Reset the start-instant -
reset
Will reset the start-instant and return duration since it was last reset in the specified unit. -
restart
-
restart
-
stop
This method can be called repeatedly without resetting (doesn't actually stop the timing process)- Returns:
- The duration since instantiation or reset.
-
stop
-