Package org.apache.nifi.util
Class StopWatch
java.lang.Object
org.apache.nifi.util.StopWatch
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncalculateDataRate
(long bytes) long
getDuration
(TimeUnit timeUnit) Returns the amount of time that the StopWatch was running.long
getElapsed
(TimeUnit timeUnit) Returns the amount of time that has elapsed since the timer was started.void
start()
void
stop()
-
Field Details
-
startNanos
private long startNanos -
duration
private long duration
-
-
Constructor Details
-
StopWatch
public StopWatch()Creates a StopWatch but does not start it -
StopWatch
public StopWatch(boolean autoStart) - Parameters:
autoStart
- whether or not the timer should be started automatically
-
-
Method Details
-
start
public void start() -
stop
public void stop() -
getDuration
Returns the amount of time that the StopWatch was running.- Parameters:
timeUnit
- the unit for which the duration should be reported- Returns:
- the duration of the stopwatch in the specified unit
- Throws:
IllegalStateException
- if the StopWatch has not been stopped viastop()
-
getElapsed
Returns the amount of time that has elapsed since the timer was started.- Parameters:
timeUnit
- the unit for which the elapsed time should be computed- Returns:
- the elapsed time in the specified unit
-
calculateDataRate
-
getDuration
-