org.apache.hadoop.metrics2.lib
Class MutableStat

java.lang.Object
  extended by org.apache.hadoop.metrics2.lib.MutableMetric
      extended by org.apache.hadoop.metrics2.lib.MutableStat
Direct Known Subclasses:
MutableRate

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class MutableStat
extends MutableMetric

A mutable metric with stats. Useful for keeping throughput/latency stats.


Constructor Summary
MutableStat(String name, String description, String sampleName, String valueName)
          Construct a snapshot stat metric with extended stat off by default
MutableStat(String name, String description, String sampleName, String valueName, boolean extended)
          Construct a sample statistics metric
 
Method Summary
 void add(long value)
          Add a snapshot to the metric
 void add(long numSamples, long sum)
          Add a number of samples and their sum to the running stat
 void resetMinMax()
          Reset the all time min max of the metric
 void snapshot(MetricsRecordBuilder builder, boolean all)
          Get a snapshot of the metric
 
Methods inherited from class org.apache.hadoop.metrics2.lib.MutableMetric
changed, clearChanged, setChanged, snapshot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutableStat

public MutableStat(String name,
                   String description,
                   String sampleName,
                   String valueName,
                   boolean extended)
Construct a sample statistics metric

Parameters:
name - of the metric
description - of the metric
sampleName - of the metric (e.g. "Ops")
valueName - of the metric (e.g. "Time", "Latency")
extended - create extended stats (stdev, min/max etc.) by default.

MutableStat

public MutableStat(String name,
                   String description,
                   String sampleName,
                   String valueName)
Construct a snapshot stat metric with extended stat off by default

Parameters:
name - of the metric
description - of the metric
sampleName - of the metric (e.g. "Ops")
valueName - of the metric (e.g. "Time", "Latency")
Method Detail

add

public void add(long numSamples,
                long sum)
Add a number of samples and their sum to the running stat

Parameters:
numSamples - number of samples
sum - of the samples

add

public void add(long value)
Add a snapshot to the metric

Parameters:
value - of the metric

snapshot

public void snapshot(MetricsRecordBuilder builder,
                     boolean all)
Description copied from class: MutableMetric
Get a snapshot of the metric

Specified by:
snapshot in class MutableMetric
Parameters:
builder - the metrics record builder
all - if true, snapshot unchanged metrics as well

resetMinMax

public void resetMinMax()
Reset the all time min max of the metric



Copyright © 2014 Apache Software Foundation. All Rights Reserved.