Package org.eclipse.jetty.util.statistic
Class CounterStatistic
java.lang.Object
org.eclipse.jetty.util.statistic.CounterStatistic
Statistics on a counter value.
This class keeps the total, current and maximum value of a counter that can be incremented and decremented. The total refers only to increments.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
add
(long delta) long
Decrements the value by one.long
long
getMax()
long
getTotal()
long
Increments the value by one.void
reset()
Resets the max and total to the current value.void
reset
(long value) Resets the max, total and current value to the given parameter.toString()
-
Constructor Details
-
CounterStatistic
public CounterStatistic()
-
-
Method Details
-
reset
public void reset()Resets the max and total to the current value. -
reset
public void reset(long value) Resets the max, total and current value to the given parameter.- Parameters:
value
- the new current value
-
add
public long add(long delta) - Parameters:
delta
- the amount to add to the counter- Returns:
- the new counter value
-
increment
public long increment()Increments the value by one.- Returns:
- the new counter value after the increment
-
decrement
public long decrement()Decrements the value by one.- Returns:
- the new counter value after the decrement
-
getMax
public long getMax()- Returns:
- max counter value
-
getCurrent
public long getCurrent()- Returns:
- current counter value
-
getTotal
public long getTotal()- Returns:
- total counter value
-
toString
-