public class StopwatchMXBeanImpl extends AbstractSimonMXBeanImpl implements StopwatchMXBean
Stopwatch
. It is not created
by default when JMX is activated - it must be created explicitely.
JmxRegisterCallback
can be used to automate this.
Class can be subclassed to override default behavior if desired, stopwatch
is declared protected for this reason.Modifier and Type | Field and Description |
---|---|
protected Stopwatch |
stopwatch
Wrapped
Stopwatch instance - protected for subclasses. |
Constructor and Description |
---|
StopwatchMXBeanImpl(Stopwatch stopwatch)
Creates the MX bean for the provided Stopwatch.
|
Modifier and Type | Method and Description |
---|---|
long |
getActive()
Returns current number of measured splits (concurrently running).
|
long |
getCounter()
Returns usage count of the stopwatch.
|
long |
getLast()
Returns value of the last added split - whether it was added directly or with stop method.
|
String |
getLastAsString()
Returns value of the last added split as formatted string.
|
long |
getMax()
Returns maximal time split value in nanoseconds.
|
long |
getMaxActive()
Returns peek value of active concurrent splits.
|
long |
getMaxActiveTimestamp()
Returns ms timestamp when the last peek of the active split count occurred.
|
long |
getMaxTimestamp()
Returns ms timestamp when the max value was measured.
|
double |
getMean()
Returns mean value (average) of all measured values.
|
long |
getMin()
Returns minimal time split value in nanoseconds.
|
long |
getMinTimestamp()
Returns ms timestamp when the min value was measured.
|
double |
getStandardDeviation()
Returns standard deviation for all measured values.
|
long |
getTotal()
Returns total sum of all split times in nanoseconds.
|
String |
getType()
Returns Simon type used as a property in the
ObjectName . |
double |
getVariance()
Returns unbiased estimate of the population variance.
|
double |
getVarianceN()
Returns variance value of all measured values (entire population).
|
StopwatchSample |
sample()
Samples Simon values and returns them in a Java Bean derived from Sample interface.
|
StopwatchSample |
sampleIncrement(String key)
Samples increment in Simon values since the previous call of this method with the
same key.
|
protected Simon |
simon()
Returns the wrapped Simon.
|
boolean |
stopIncrementalSampling(String key)
Stops incremental sampling for the key, removing any internal information for the key.
|
getChildrenNames, getFirstUsage, getFirstUsageAsString, getLastUsage, getLastUsageAsString, getName, getNote, getParentName, getState, isEnabled, setNote, setState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildrenNames, getFirstUsage, getFirstUsageAsString, getLastUsage, getLastUsageAsString, getName, getNote, getParentName, getState, isEnabled, setNote, setState
public StopwatchMXBeanImpl(Stopwatch stopwatch)
stopwatch
- wrapped Stopwatchpublic long getTotal()
StopwatchMXBean
getTotal
in interface StopwatchMXBean
Stopwatch.getTotal()
public final long getLast()
StopwatchMXBean
getLast
in interface StopwatchMXBean
Stopwatch.getLast()
public final String getLastAsString()
StopwatchMXBean
getLastAsString
in interface StopwatchMXBean
public long getCounter()
StopwatchMXBean
addTime
and
stop
- that means that it's updated every time the next time split is added.getCounter
in interface StopwatchMXBean
Stopwatch.getCounter()
public long getMax()
StopwatchMXBean
getMax
in interface StopwatchMXBean
Stopwatch.getMax()
public long getMin()
StopwatchMXBean
getMin
in interface StopwatchMXBean
Stopwatch.getMin()
public long getMaxTimestamp()
StopwatchMXBean
getMaxTimestamp
in interface StopwatchMXBean
Stopwatch.getMaxTimestamp()
public long getMinTimestamp()
StopwatchMXBean
getMinTimestamp
in interface StopwatchMXBean
Stopwatch.getMinTimestamp()
public long getActive()
StopwatchMXBean
getActive
in interface StopwatchMXBean
Stopwatch.getActive()
public long getMaxActive()
StopwatchMXBean
getMaxActive
in interface StopwatchMXBean
Stopwatch.getMaxActive()
public long getMaxActiveTimestamp()
StopwatchMXBean
getMaxActiveTimestamp
in interface StopwatchMXBean
Stopwatch.getMaxActiveTimestamp()
public double getMean()
StopwatchMXBean
getMean
in interface StopwatchMXBean
Stopwatch.getMean()
public double getStandardDeviation()
StopwatchMXBean
getStandardDeviation
in interface StopwatchMXBean
Stopwatch.getStandardDeviation()
public double getVariance()
StopwatchMXBean
getVariance
in interface StopwatchMXBean
Stopwatch.getVariance()
public double getVarianceN()
StopwatchMXBean
getVarianceN
in interface StopwatchMXBean
Stopwatch.getVarianceN()
public final StopwatchSample sample()
SimonSuperMXBean
sample
in interface SimonSuperMXBean
sample
in interface StopwatchMXBean
public StopwatchSample sampleIncrement(String key)
SimonSuperMXBean
SimonSuperMXBean.sample()
. Any subsequent calls with the key
provide increments.
Clients should use a unique key (GUID, host name, etc.), to avoid interference
with other clients.sampleIncrement
in interface SimonSuperMXBean
sampleIncrement
in interface StopwatchMXBean
key
- key used to access incremental sampleSample
with value incrementspublic final String getType()
SimonSuperMXBean
ObjectName
.getType
in interface SimonSuperMXBean
public boolean stopIncrementalSampling(String key)
SimonSuperMXBean
SimonSuperMXBean.sampleIncrement(String)
for the key will be considered the first
call for the key.stopIncrementalSampling
in interface SimonSuperMXBean
key
- key used to access incremental sampleprotected final Simon simon()
AbstractSimonMXBeanImpl
simon
in class AbstractSimonMXBeanImpl
Copyright © 2019. All rights reserved.