Class OperationDuration

java.lang.Object
org.apache.hadoop.util.OperationDuration
Direct Known Subclasses:
DurationInfo

@Public @Unstable public class OperationDuration extends Object
Little duration counter.
  • 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

      public String getDurationString()
      Return the duration as humanTime(long).
      Returns:
      a printable duration.
    • humanTime

      public static String humanTime(long time)
      Convert to a human time of minutes:seconds.millis.
      Parameters:
      time - time to humanize.
      Returns:
      a printable value.
    • toString

      public String toString()
      Return the duration as humanTime(long).
      Overrides:
      toString in class Object
      Returns:
      a printable duration.
    • 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

      public Duration asDuration()
      Get the duration of an operation as a java Duration instance.
      Returns:
      a duration.