Package org.ojalgo.type
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 TypeMethodDescriptionlong
long
boolean
isLessThan
(CalendarDateDuration duration) boolean
isLessThanMillis
(long millis) boolean
isLessThanNanos
(long nanos) boolean
isMoreThan
(CalendarDateDuration duration) boolean
isMoreThanMillis
(long millis) boolean
isMoreThanNanos
(long nanos) static CalendarDateDuration
Meassure task duration using this class' stopwatch functionality.static CalendarDateDuration
meassure
(Runnable task, CalendarDateUnit unit) static <T> Stopwatch.TimedResult
<T> static <T> Stopwatch.TimedResult
<T> meassure
(Callable<T> task, CalendarDateUnit unit) void
reset()
Reset the start-instantlong
reset
(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
-