public class Counters
extends java.lang.Object
Constructor and Description |
---|
Counters() |
Modifier and Type | Method and Description |
---|---|
Counters |
forReading() |
long |
get(java.lang.String name) |
void |
inc(java.lang.String name)
Increase the metric with the given name by one.
|
void |
inc(java.lang.String name,
long delta)
Increase the metric with the given name by the given amount.
|
void |
reset()
Reset all metrics to zero.
|
void |
set(java.lang.String name,
long value)
Set the metric with the given name to the given value.
|
java.lang.String |
toString() |
public long get(java.lang.String name)
public void inc(java.lang.String name)
name
- The name of the metricpublic void inc(java.lang.String name, long delta)
name
- The name of the metricdelta
- The amount to increase the metric withpublic void set(java.lang.String name, long value)
name
- The name of the metricvalue
- The value to set the metric topublic void reset()
public Counters forReading()
public java.lang.String toString()
toString
in class java.lang.Object