Class StatisticDurationTracker

java.lang.Object
org.apache.hadoop.util.OperationDuration
org.apache.hadoop.fs.statistics.impl.StatisticDurationTracker
All Implemented Interfaces:
AutoCloseable, DurationTracker

public class StatisticDurationTracker extends OperationDuration implements DurationTracker
Track the duration of an object. When closed the min/max/mean statistics are updated. In the constructor, the counter with name of 'key' is incremented -default is by 1, but can be set to other values, including 0.
  • Constructor Details

    • StatisticDurationTracker

      public StatisticDurationTracker(IOStatisticsStore iostats, String key)
      Constructor -increments the counter by 1.
      Parameters:
      iostats - statistics to update
      key - prefix of values.
    • StatisticDurationTracker

      public StatisticDurationTracker(IOStatisticsStore iostats, String key, long count)
      Constructor. If the supplied count is greater than zero, the counter of the key name is updated.
      Parameters:
      iostats - statistics to update
      key - Key to use as prefix of values.
      count - #of times to increment the matching counter.
  • Method Details

    • failed

      public void failed()
      Description copied from interface: DurationTracker
      The operation failed. Failure statistics will be updated.
      Specified by:
      failed in interface DurationTracker
    • close

      public void close()
      Set the finished time and then update the statistics. If the operation failed then the key + .failures counter will be incremented by one. The operation min/mean/max values will be updated with the duration; on a failure these will all be the .failures metrics.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface DurationTracker
    • toString

      public String toString()
      Description copied from class: OperationDuration
      Return the duration as OperationDuration.humanTime(long).
      Overrides:
      toString in class OperationDuration
      Returns:
      a printable duration.