org.apache.hadoop.mapred

## Class PeriodicStatsAccumulator

- java.lang.Object
- - org.apache.hadoop.mapred.PeriodicStatsAccumulator

-     @InterfaceAudience.Private
       @InterfaceStability.Unstable
      public abstract class PeriodicStatsAccumulator
      extends Object

  This abstract class that represents a bucketed series of measurements of a quantity being measured in a running task attempt.

  The sole constructor is called with a count, which is the number of buckets into which we evenly divide the spectrum of progress from 0.0D to 1.0D . In the future we may provide for custom split points that don't have to be uniform.

  A subclass determines how we fold readings for portions of a bucket and how we interpret the readings by overriding `extendInternal(...)` and `initializeInterval()`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `count`
    `protected int[]` | `values`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `advanceState(double newProgress, int newValue)`
    `protected void` | `extend(double newProgress, int newValue)` This method calls `extendInternal` at least once.
    `protected abstract void` | `extendInternal(double newProgress, int newValue)` adds a new reading to the current bucket.
    `protected int[]` | `getValues()`
    `protected void` | `initializeInterval()` initializes the state variables to be ready for a new interval

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### count

          protected final int count

    - #### values

          protected final int[] values

  - ### Method Detail

    - #### getValues

          protected int[] getValues()

    - #### extendInternal

          protected abstract void extendInternal(double newProgress,
                                                 int newValue)

      adds a new reading to the current bucket.
      Parameters:
        `newProgress` - the endpoint of the interval this new reading covers
        `newValue` - the value of the reading at `newProgress` The class has three instance variables, `oldProgress` and `oldValue` and `currentAccumulation`. `extendInternal` can count on three things: 1: The first time it's called in a particular instance, both oldXXX's will be zero. 2: oldXXX for a later call is the value of newXXX of the previous call. This ensures continuity in accumulation from one call to the next. 3: `currentAccumulation` is owned by `initializeInterval` and `extendInternal`.

    - #### initializeInterval

          protected void initializeInterval()

      initializes the state variables to be ready for a new interval

    - #### extend

          protected void extend(double newProgress,
                                int newValue)

      This method calls `extendInternal` at least once. It divides the current progress interval [from the last call's `newProgress` to this call's `newProgress` ] into one or more subintervals by splitting at any point which is an interval boundary if there are any such points. It then calls `extendInternal` for each subinterval, or the whole interval if there are no splitting points.

      For example, if the value was `300` last time with `0.3` progress, and count is `5`, and you get a new reading with the variable at `700` and progress at `0.7`, you get three calls to `extendInternal`: one extending from progress `0.3` to `0.4` [the next boundary] with a value of `400`, the next one through `0.6` with a value of `600`, and finally one at `700` with a progress of `0.7` .

      Parameters:
        `newProgress` - the endpoint of the progress range this new reading covers
        `newValue` - the value of the reading at `newProgress`

    - #### advanceState

          protected void advanceState(double newProgress,
                                      int newValue)

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.