org.apache.hadoop.metrics2.util
Class MetricSampleQuantiles

java.lang.Object
  extended by org.apache.hadoop.metrics2.util.MetricSampleQuantiles

@InterfaceAudience.Private
public class MetricSampleQuantiles
extends Object

Implementation of the Cormode, Korn, Muthukrishnan, and Srivastava algorithm for streaming calculation of targeted high-percentile epsilon-approximate quantiles. This is a generalization of the earlier work by Greenwald and Khanna (GK), which essentially allows different error bounds on the targeted quantiles, which allows for far more efficient calculation of high-percentiles. See: Cormode, Korn, Muthukrishnan, and Srivastava "Effective Computation of Biased Quantiles over Data Streams" in ICDE 2005 Greenwald and Khanna, "Space-efficient online computation of quantile summaries" in SIGMOD 2001


Constructor Summary
MetricSampleQuantiles(MetricQuantile[] quantiles)
           
 
Method Summary
 void clear()
          Resets the estimator, clearing out all previously inserted items
 long getCount()
          Returns the number of items that the estimator has processed
 int getSampleCount()
          Returns the number of samples kept by the estimator
 void insert(long v)
          Add a new value from the stream.
 Map<MetricQuantile,Long> snapshot()
          Get a snapshot of the current values of all the tracked quantiles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetricSampleQuantiles

public MetricSampleQuantiles(MetricQuantile[] quantiles)
Method Detail

insert

public void insert(long v)
Add a new value from the stream.

Parameters:
v -

snapshot

public Map<MetricQuantile,Long> snapshot()
                                  throws IOException
Get a snapshot of the current values of all the tracked quantiles.

Returns:
snapshot of the tracked quantiles
Throws:
IOException - if no items have been added to the estimator

getCount

public long getCount()
Returns the number of items that the estimator has processed

Returns:
count total number of items processed

getSampleCount

public int getSampleCount()
Returns the number of samples kept by the estimator

Returns:
count current number of samples

clear

public void clear()
Resets the estimator, clearing out all previously inserted items



Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.