StatsCollector (Hyperic HQ Plugin API)
Keywords: org.hyperic.util.stats.StatsCollector 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.util.stats
Class StatsCollector

    java.lang.Object
      org.hyperic.util.stats.StatsCollector

    public class StatsCollector

extends java.lang.Object

The StatsCollector is a class used to calculate metrics based on a series of events. Events consist of a value and a timestamp. This class is synchronized.

Constructor Summary
`StatsCollector(int size)` Create a new collector which is able to internally store 'size' elements.

Method Summary
`void` | `add(double value, long timestamp)` Add a value to the collection.
`java.lang.String` | `dump()`
`long` | `getNewestTime()` Get the timestamp of the newest entry (or -1 if there are no entries)
`long` | `getOldestTime()` Get the timestamp of the oldest entry (or -1 if there are no entries)
`int` | `getSize()` Get the # of elements in the collector
`double` | `getTotal()` Get the sum of all values.
`static void` | `main(java.lang.String[] args)`
`double` | `valPerTimestamp()`
`double` | `valPerTimestamp(long newestTime)` Get the value per timestamp increment.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StatsCollector

    public StatsCollector(int size)

  Create a new collector which is able to internally store 'size' elements.

Method Detail

### add

    public void add(double value,
                    long timestamp)

  Add a value to the collection. Old values will be evicted from the collection if the addition would exceed the internal size.

### getTotal

    public double getTotal()

  Get the sum of all values.

### getOldestTime

    public long getOldestTime()

  Get the timestamp of the oldest entry (or -1 if there are no entries)

### getNewestTime

    public long getNewestTime()

  Get the timestamp of the newest entry (or -1 if there are no entries)

### valPerTimestamp

    public double valPerTimestamp(long newestTime)

  Get the value per timestamp increment. I.e: getTotal() / (endTime - getOldestTime())

### valPerTimestamp

    public double valPerTimestamp()

### getSize

    public int getSize()

  Get the # of elements in the collector

### dump

    public java.lang.String dump()

### main

    public static void main(java.lang.String[] args)

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.