|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javasimon.AbstractSimon
org.javasimon.CounterImpl
final class CounterImpl
Class implements Counter interface - see there for how to use Counter.
Counter| Field Summary | |
|---|---|
private long |
counter
An internal counter. |
private long |
decrementSum
Sum of all decrements. |
private long |
incrementSum
Sum of all increments. |
private long |
max
A maximum tracker. |
private long |
maxTimestamp
|
private long |
min
A minimum tracker - only negative values. |
private long |
minTimestamp
|
| Fields inherited from class org.javasimon.AbstractSimon |
|---|
enabled, firstUsage, lastUsage, manager |
| Constructor Summary | |
|---|---|
CounterImpl(String name,
Manager manager)
Construts Counter Simon with a specified name and for the specified manager. |
|
| Method Summary | |
|---|---|
Counter |
decrease()
Decrements the counter by one. |
Counter |
decrease(long dec)
Increments the counter by the specified value. |
long |
getCounter()
Returns the current value of the counter. |
long |
getDecrementSum()
Returns the sum of all decremented values (as a positive number). |
long |
getIncrementSum()
Returns the sum of all incremented values. |
long |
getMax()
Returns maximal value of counter. |
long |
getMaxTimestamp()
Returns ms timestamp when the max value was reached. |
long |
getMin()
Returns minimal value of counter. |
long |
getMinTimestamp()
Returns ms timestamp when the min value was reached. |
Counter |
increase()
Increments the counter by one. |
Counter |
increase(long inc)
Increments the counter by the specified value. |
private void |
privateSet(long val,
long now)
|
Counter |
reset()
Resets the Simon values related to the measuring, timestamps and so on - usage timestamps, state, attributes are not affected. |
CounterSample |
sample()
Samples Simon values and returns them in a Java Bean derived from Sample interface. |
CounterSample |
sampleAndReset()
Samples Simon values and returns them in a Java Bean derived from Sample interface and resets the Simon. |
Counter |
set(long val)
Sets the value of the counter to specified value. |
String |
toString()
Returns Simon basic information, counter, max value and min value as a human readable string. |
private void |
updateUsages(long now)
Updates usage statistics. |
| Methods inherited from class org.javasimon.AbstractSimon |
|---|
addChild, getAttribute, getAttribute, getAttributeNames, getCopyAsSortedMap, getFirstUsage, getChildren, getLastReset, getLastUsage, getName, getNote, getParent, getState, isEnabled, removeAttribute, replaceChild, resetCommon, sampleCommon, setAttribute, setNote, setParent, setState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.javasimon.Simon |
|---|
getFirstUsage, getChildren, getLastReset, getLastUsage, getName, getNote, getParent, getState, isEnabled, setNote, setState |
| Methods inherited from interface org.javasimon.HasAttributes |
|---|
getAttribute, getAttribute, getAttributeNames, getCopyAsSortedMap, removeAttribute, setAttribute |
| Field Detail |
|---|
private long counter
private long incrementSum
private long decrementSum
private long max
private long maxTimestamp
private long min
private long minTimestamp
| Constructor Detail |
|---|
CounterImpl(String name,
Manager manager)
name - Simon's namemanager - owning manager| Method Detail |
|---|
public Counter set(long val)
Counter
set in interface Counterval - new counter value
private void privateSet(long val,
long now)
public Counter increase()
Counter
increase in interface Counterpublic Counter decrease()
Counter
decrease in interface Counterprivate void updateUsages(long now)
now - current millis timestamppublic Counter increase(long inc)
Counter
increase in interface Counterinc - added value
public Counter decrease(long dec)
Counter
decrease in interface Counterdec - subtracted value
public Counter reset()
SimonSimon.getLastReset(). Reset is perfomed even for disabled Simons.
reset in interface Counterreset in interface Simonpublic CounterSample sampleAndReset()
Simon
sampleAndReset in interface CountersampleAndReset in interface Simonpublic CounterSample sample()
Simon
sample in interface Countersample in interface Simonpublic long getCounter()
Counter
getCounter in interface Counterpublic long getMin()
Counter
getMin in interface Counterpublic long getMinTimestamp()
Counter
getMinTimestamp in interface Counterpublic long getMax()
Counter
getMax in interface Counterpublic long getMaxTimestamp()
Counter
getMaxTimestamp in interface Counterpublic long getIncrementSum()
Counter
getIncrementSum in interface Counterpublic long getDecrementSum()
Counter
getDecrementSum in interface Counterpublic String toString()
toString in class AbstractSimonAbstractSimon.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||