Package org.apache.hadoop.util
Class OperationDuration
java.lang.Object
org.apache.hadoop.util.OperationDuration
- Direct Known Subclasses:
DurationInfo
Little duration counter.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the duration of an operation as a java Duration instance.voidfinished()Update the finished time with the current system time.Return the duration ashumanTime(long).static StringhumanTime(long time) Convert to a human time of minutes:seconds.millis.protected longtime()Evaluate the system time.toString()Return the duration ashumanTime(long).longvalue()Get the duration in milliseconds.
-
Constructor Details
-
OperationDuration
public OperationDuration()Instantiate. The start time and finished time are both set to the current clock time.
-
-
Method Details
-
time
protected long time()Evaluate the system time.- Returns:
- the current clock time.
-
finished
public void finished()Update the finished time with the current system time. -
getDurationString
Return the duration ashumanTime(long).- Returns:
- a printable duration.
-
humanTime
Convert to a human time of minutes:seconds.millis.- Parameters:
time- time to humanize.- Returns:
- a printable value.
-
toString
Return the duration ashumanTime(long). -
value
public long value()Get the duration in milliseconds.This will be 0 until a call to
finished()has been made.- Returns:
- the currently recorded duration.
-
asDuration
Get the duration of an operation as a java Duration instance.- Returns:
- a duration.
-