public class NanoCounter extends Facultative implements NanoCounterMBean, LongCounter
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.atomic.AtomicLong |
count
Total number of calls
|
private java.util.concurrent.atomic.AtomicLong |
total
Total time
|
| Constructor and Description |
|---|
NanoCounter() |
| Modifier and Type | Method and Description |
|---|---|
long |
getCount()
Get the number of operations
|
long |
getTotalTimeMs()
Return total time in ms
|
long |
getTotalTimeNs()
Return total time in ns
|
void |
print(java.lang.String file)
Print counters' values to the file
|
void |
print(java.lang.String comment,
java.lang.String file)
Print counters' values to the file
|
void |
reset()
Reset counters
|
java.lang.String |
toString(java.lang.String ts,
java.lang.String comment)
Return the string representation of the counter
|
void |
update(long value)
Update counter
|
enable, getAnnotation, isEnabled, register, setAnnotationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitenable, getAnnotation, isEnabled, setAnnotationdumpprivate final java.util.concurrent.atomic.AtomicLong total
private final java.util.concurrent.atomic.AtomicLong count
public void reset()
reset in interface NanoCounterMBeanpublic long getTotalTimeNs()
getTotalTimeNs in interface NanoCounterMBeanpublic long getTotalTimeMs()
getTotalTimeMs in interface NanoCounterMBeanpublic long getCount()
getCount in interface NanoCounterMBeanpublic void update(long value)
update in interface LongCountervalue - new valuepublic void print(java.lang.String file)
throws java.io.IOException
print in interface NanoCounterMBeanfile - output file name (will be appended if exists)java.io.IOExceptionpublic void print(java.lang.String comment,
java.lang.String file)
throws java.io.IOException
comment - commentfile - output file name (will be appended if exists)java.io.IOExceptionpublic java.lang.String toString(java.lang.String ts,
java.lang.String comment)
throws java.io.IOException
toString in interface LongCounterts - comment - commentjava.io.IOException