public final class OpCounter extends Object implements OpInstrument
This is a MUTABLE form of OpSnapshot since it can increase in value. However it is THREAD SAFE in the sense
that the values it exposes are IMMUTABLE snapshots in time. You CANNOT get access to the underlying counter values
directly.
A OpCounter can be thought of as 3 Counter's rolled into one object.
Counter that shows how
many times the operation has been invoked.Counter that shows how long
the operation has taken in total.Counter that shows how big the
results have been.
In fact OpCounter and OpSnapshot is an OpInstrument/Instrument and hence can be recorded as one discrete object
| Constructor and Description |
|---|
OpCounter(OpSnapshot opSnapshot) |
OpCounter(String name) |
OpCounter(String name,
long invocationCount,
long elapsedTotal,
long elapsedMin,
long elapsedMax,
long resultSetSize,
long cpuTotal,
long cpuMin,
long cpuMax) |
| Modifier and Type | Method and Description |
|---|---|
OpCounter |
add(OpCounter opCounter)
Called to increment the values of the OpCounter by the values in another
OpCounter. |
OpCounter |
add(OpSnapshot opSnapshot)
Called to increment the values of the OpCounter by the values in the
OpSnapshot. |
int |
compareTo(Instrument that)
A compareTo method that uses underlying OpSnapshot compareTo
|
boolean |
equals(Object o) |
long |
getCpuMaxTime(TimeUnit unit) |
long |
getCpuMinTime(TimeUnit unit) |
long |
getCpuTime() |
long |
getCpuTotalTime(TimeUnit unit) |
long |
getElapsedMaxTime(TimeUnit unit) |
long |
getElapsedMinTime(TimeUnit unit) |
long |
getElapsedTotalTime(TimeUnit unit) |
long |
getInvocationCount() |
long |
getMillisecondsTaken() |
String |
getName() |
long |
getResultSetSize() |
long |
getValue() |
int |
hashCode() |
OpSnapshot |
snapshot()
This returns the current snapshot value of the counter.
|
String |
toString() |
public OpCounter(String name)
public OpCounter(OpSnapshot opSnapshot)
public OpCounter(String name, long invocationCount, long elapsedTotal, long elapsedMin, long elapsedMax, long resultSetSize, long cpuTotal, long cpuMin, long cpuMax)
public OpCounter add(OpCounter opCounter)
OpCounter.opCounter - a counter of an operationpublic OpCounter add(OpSnapshot opSnapshot)
OpSnapshot.opSnapshot - a snapshot of an operationpublic OpSnapshot snapshot()
public long getInvocationCount()
getInvocationCount in interface OpInstrumentpublic long getMillisecondsTaken()
getMillisecondsTaken in interface OpInstrumentpublic long getElapsedTotalTime(TimeUnit unit)
getElapsedTotalTime in interface OpInstrumentunit - the unit to express the time withpublic long getElapsedMinTime(TimeUnit unit)
getElapsedMinTime in interface OpInstrumentunit - the unit to express the time withpublic long getElapsedMaxTime(TimeUnit unit)
getElapsedMaxTime in interface OpInstrumentunit - the unit to express the time withpublic long getResultSetSize()
getResultSetSize in interface OpInstrumentpublic long getCpuTime()
getCpuTime in interface OpInstrumentpublic long getCpuTotalTime(TimeUnit unit)
getCpuTotalTime in interface OpInstrumentunit - the unit to express the time withpublic long getCpuMinTime(TimeUnit unit)
getCpuMinTime in interface OpInstrumentunit - the unit to express the time withpublic long getCpuMaxTime(TimeUnit unit)
getCpuMaxTime in interface OpInstrumentunit - the unit to express the time withpublic long getValue()
getValue in interface Instrumentpublic int compareTo(Instrument that)
compareTo in interface Comparable<Instrument>that - the object to comparepublic String getName()
getName in interface InstrumentCopyright © 2016 Atlassian. All rights reserved.