MethodInvocationMetricsGroup (Hyperic HQ Plugin API)
Keywords: org.hyperic.hq.common.MethodInvocationMetricsGroup class

Overview | Package | Class | Tree | Deprecated | Index | Help
| 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

## org.hyperic.hq.common
Class MethodInvocationMetricsGroup

    java.lang.Object
      org.hyperic.hq.common.MethodInvocationMetricsGroup

    public class MethodInvocationMetricsGroup

extends java.lang.Object

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

### QUEUE_CAPACITY

    public static final java.lang.String QUEUE_CAPACITY

  The system property key for the capacity of the internal metrics queue.

  See Also:
    Constant Field Values

### DEFAULT_QUEUE_CAPACITY

    public static final int DEFAULT_QUEUE_CAPACITY

  The default queue capacity (1000).

  See Also:
    Constant Field Values

Constructor Detail

### MethodInvocationMetricsGroup

    public MethodInvocationMetricsGroup(java.lang.String metricGroupName)

  Creates an instance using the invocation time queue capacity specified by the `QUEUE_CAPACITY` system property value.

  Parameters:
    `metricGroupName` - The metric group name.

### MethodInvocationMetricsGroup

    public MethodInvocationMetricsGroup(java.lang.String metricGroupName,
                                        int queueCapacity)

  Creates an instance.

  Parameters:
    `metricGroupName` - The metric group name. A `null` value will be converted to the empty string.
    `queueCapacity` - The capacity of the invocation time queue.
  Throws:
    `java.lang.IllegalArgumentException` - if the capacity is not greater than zero.

Method Detail

### getMetricGroupName

    public java.lang.String getMetricGroupName()

  Returns:
    The metric group name.

### getQueueCapacity

    public int getQueueCapacity()

  Returns:
    The capacity of the invocation time queue.

### addInvocationTime

    public void addInvocationTime(long invocationTime)

  Add an invocation time to the internal queue, flushing the queue if the capacity is reached.

  Parameters:
    `invocationTime` - The invocation time.

### addInvocationTimeSynch

    public void addInvocationTimeSynch(long invocationTime)

  Add an invocation time and update the metrics in the group immediately.

  Parameters:
    `invocationTime` - The invocation time.

### flush

    public void flush()

  Flush the metric group, updating the metrics in the group with the invocation times currently stored in the queue.

### getNumberInvocations

    public long getNumberInvocations()

  Returns:
    The total number of added invocation time metrics.

### getMaxInvocationTime

    public long getMaxInvocationTime()

  Returns:
    The maximum invocation time metric.

### getMinInvocationTime

    public long getMinInvocationTime()

  Returns:
    The minimum invocation time metric.

### getAverageInvocationTime

    public double getAverageInvocationTime()

  Returns:
    The average invocation time metric or `Double.NaN` if no invocation time metric has been added.

### reset

    public void reset()

  Reset all metrics in the group.

Overview | Package | Class | Tree | Deprecated | Index | Help
| 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

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.