|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.hq.common.MethodInvocationMetricsGroup
public class MethodInvocationMetricsGroup
An object for maintaining a group of metrics derived from method invocation times on the instrumented method. This object maintains its own private internal queue such that the metric values in the group will be updated only after the internal queue is flushed. Flushing occurs automatically when the queue capacity is reached but it may be invoked explicitly by any client wishing to obtain the most recent snapshot of metrics. Clients may also choose to update the metric values in the group synchronously when a new method invocation time value is added. In this case, the internal queue and flush operations are not used. Each metric in the group (num invocations/max,min,avg invocation time) is guaranteed to be consistent with the current flushed state of the group. There is no guarantee that the metrics within the group will be consistent with respect to one another especially if there are concurrent threads flushing and querying the group.
Field Summary | |
---|---|
static int |
DEFAULT_QUEUE_CAPACITY
The default queue capacity (1000). |
static java.lang.String |
QUEUE_CAPACITY
The system property key for the capacity of the internal metrics queue. |
Constructor Summary | |
---|---|
MethodInvocationMetricsGroup(java.lang.String metricGroupName)
Creates an instance using the invocation time queue capacity specified by the QUEUE_CAPACITY system property value. |
|
MethodInvocationMetricsGroup(java.lang.String metricGroupName,
int queueCapacity)
Creates an instance. |
Method Summary | |
---|---|
void |
addInvocationTime(long invocationTime)
Add an invocation time to the internal queue, flushing the queue if the capacity is reached. |
void |
addInvocationTimeSynch(long invocationTime)
Add an invocation time and update the metrics in the group immediately. |
void |
flush()
Flush the metric group, updating the metrics in the group with the invocation times currently stored in the queue. |
double |
getAverageInvocationTime()
|
long |
getMaxInvocationTime()
|
java.lang.String |
getMetricGroupName()
|
long |
getMinInvocationTime()
|
long |
getNumberInvocations()
|
int |
getQueueCapacity()
|
void |
reset()
Reset all metrics in the group. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String QUEUE_CAPACITY
public static final int DEFAULT_QUEUE_CAPACITY
Constructor Detail |
---|
public MethodInvocationMetricsGroup(java.lang.String metricGroupName)
QUEUE_CAPACITY
system property value.
metricGroupName
- The metric group name.public MethodInvocationMetricsGroup(java.lang.String metricGroupName, int queueCapacity)
metricGroupName
- The metric group name. A null
value
will be converted to the empty string.queueCapacity
- The capacity of the invocation time queue.
java.lang.IllegalArgumentException
- if the capacity is not greater than zero.Method Detail |
---|
public java.lang.String getMetricGroupName()
public int getQueueCapacity()
public void addInvocationTime(long invocationTime)
invocationTime
- The invocation time.public void addInvocationTimeSynch(long invocationTime)
invocationTime
- The invocation time.public void flush()
public long getNumberInvocations()
public long getMaxInvocationTime()
public long getMinInvocationTime()
public double getAverageInvocationTime()
Double.NaN
if no
invocation time metric has been added.public void reset()
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |