Class Stopwatch
java.lang.Object
cz.fidentis.analyst.gui.task.batch.Stopwatch
Stopwatch.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe same asgetTotalTime()
, but the time is returned asDuration
long
Returns the sum of time spans measured so far.void
reset()
Rests the stopwatch, i.e., clears the all previous time measurements.void
start()
Starts measuring a time span.long
stop()
Stops the time span.toString()
-
Constructor Details
-
Stopwatch
Constructor.- Parameters:
label
- label used for printing the time. Can benull
-
-
Method Details
-
start
public void start()Starts measuring a time span. -
stop
public long stop()Stops the time span. Span is added to total measured time and also returned.- Returns:
- span duration in milliseconds
-
getTotalTime
public long getTotalTime()Returns the sum of time spans measured so far. Call thestop()
first to include the last span as well.- Returns:
- total measured time in milliseconds
-
getDuration
The same asgetTotalTime()
, but the time is returned asDuration
- Returns:
- total measured time as
Duration
-
reset
public void reset()Rests the stopwatch, i.e., clears the all previous time measurements. -
toString
-