MetricsTimeVaryingRate (Hadoop 0.20.2-cdh3u5 API)
Date: 2012-10-05

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.metrics.util
Class MetricsTimeVaryingRate

    java.lang.Object
      org.apache.hadoop.metrics.util.MetricsBase
          org.apache.hadoop.metrics.util.MetricsTimeVaryingRate

    public class MetricsTimeVaryingRate

extends MetricsBase

The MetricsTimeVaryingRate class is for a rate based metric that naturally varies over time (e.g. time taken to create a file). The rate is averaged at each interval heart beat (the interval is set in the metrics config file). This class also keeps track of the min and max rates along with a method to reset the min-max.

Field Summary

Fields inherited from class org.apache.hadoop.metrics.util.MetricsBase
`NO_DESCRIPTION`

Constructor Summary
`MetricsTimeVaryingRate(String nam, MetricsRegistry registry)` Constructor - create a new metric
`MetricsTimeVaryingRate(String nam, MetricsRegistry registry, String description)` Constructor - create a new metric

Method Summary
`long` | `getMaxTime()` The max time for a single operation since the last reset `resetMinMax()`
`long` | `getMinTime()` The min time for a single operation since the last reset `resetMinMax()`
`long` | `getPreviousIntervalAverageTime()` The average rate of an operation in the previous interval
`int` | `getPreviousIntervalNumOps()` The number of operations in the previous interval
`void` | `inc(int numOps, long time)` Increment the metrics for numOps operations
`void` | `inc(long time)` Increment the metrics for one operation
`void` | `pushMetric(MetricsRecord mr)` Push the delta metrics to the mr.
`void` | `resetMinMax()` Reset the min max values

Methods inherited from class org.apache.hadoop.metrics.util.MetricsBase
`getDescription, getName`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MetricsTimeVaryingRate

    public MetricsTimeVaryingRate(String nam,
                                  MetricsRegistry registry,
                                  String description)

  Constructor - create a new metric

  Parameters:
    `nam` - the name of the metrics to be used to publish the metric
    `registry` - - where the metrics object will be registered

### MetricsTimeVaryingRate

    public MetricsTimeVaryingRate(String nam,
                                  MetricsRegistry registry)

  Constructor - create a new metric

  Parameters:
    `nam` - the name of the metrics to be used to publish the metric
    `registry` - - where the metrics object will be registered A description of `MetricsBase.NO_DESCRIPTION` is used

Method Detail

### inc

    public void inc(int numOps,
                    long time)

  Increment the metrics for numOps operations

  Parameters:
    `numOps` - - number of operations
    `time` - - time for numOps operations

### inc

    public void inc(long time)

  Increment the metrics for one operation

  Parameters:
    `time` - for one operation

### pushMetric

    public void pushMetric(MetricsRecord mr)

  Push the delta metrics to the mr. The delta is since the last push/interval. Note this does NOT push to JMX (JMX gets the info via `getPreviousIntervalAverageTime()` and `getPreviousIntervalNumOps()`

  Specified by:
    `pushMetric` in class `MetricsBase`
  Parameters:
    `mr` -

### getPreviousIntervalNumOps

    public int getPreviousIntervalNumOps()

  The number of operations in the previous interval

  Returns:
    - ops in prev interval

### getPreviousIntervalAverageTime

    public long getPreviousIntervalAverageTime()

  The average rate of an operation in the previous interval

  Returns:
    - the average rate.

### getMinTime

    public long getMinTime()

  The min time for a single operation since the last reset `resetMinMax()`

  Returns:
    min time for an operation

### getMaxTime

    public long getMaxTime()

  The max time for a single operation since the last reset `resetMinMax()`

  Returns:
    max time for an operation

### resetMinMax

    public void resetMinMax()

  Reset the min max values

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation