com.yammer.metrics.core
Class CounterMetric

java.lang.Object
  extended by com.yammer.metrics.core.CounterMetric
All Implemented Interfaces:
Metric

public class CounterMetric
extends Object
implements Metric

An incrementing and decrementing counter metric.


Constructor Summary
CounterMetric()
           
 
Method Summary
 void clear()
          Resets the counter to 0.
 long count()
          Returns the counter's current value.
 void dec()
          Decrement the counter by one.
 void dec(long n)
          Decrement the counter by n
 void inc()
          Increment the counter by one.
 void inc(long n)
          Increment the counter by n.
<T> void
processWith(MetricsProcessor<T> processor, MetricName name, T context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CounterMetric

public CounterMetric()
Method Detail

inc

public void inc()
Increment the counter by one.


inc

public void inc(long n)
Increment the counter by n.

Parameters:
n - the amount by which the counter will be increased

dec

public void dec()
Decrement the counter by one.


dec

public void dec(long n)
Decrement the counter by n

Parameters:
n - the amount by which the counter will be increased

count

public long count()
Returns the counter's current value.

Returns:
the counter's current value

clear

public void clear()
Resets the counter to 0.


processWith

public <T> void processWith(MetricsProcessor<T> processor,
                            MetricName name,
                            T context)
                 throws Exception
Specified by:
processWith in interface Metric
Throws:
Exception


Copyright © 2011. All Rights Reserved.