cgl.narada.performance
Class StatCollection

java.lang.Object
  extended by cgl.narada.performance.StatCollection

public class StatCollection
extends Object


Field Summary
static byte AVG_STAT
           
static byte JITTER_STAT
           
static byte MAX_STAT
           
static byte MIN_STAT
           
static byte TIME_AVG_STAT
          Average value over time of collection.
 
Constructor Summary
StatCollection()
           
 
Method Summary
 void addMetricValue(String metric, double value)
          -----------------------------------------------------------------
 double getLastSample(String metric)
          ----------------------------------------------------------------------
 Enumeration getMetrics()
          -----------------------------------------------------------------
 double getMetricStat(String metric, int numSamples, byte type)
          -----------------------------------------------------------------
 double getMetricStat(String metric, long startPeriod, long endPeriod, byte type)
          ----------------------------------------------------------------- byte MIN_STAT, MAX_STAT, AVG_STAT,
 Vector getSamples(String metric, int samples)
          -----------------------------------------------------------------
static void main(String[] args)
          =====================================================================
 void setMaxSamples(int maxSamples)
          ----------------------------------------------------------------- Maximum number of samples to store for each metric.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AVG_STAT

public static final byte AVG_STAT
See Also:
Constant Field Values

MAX_STAT

public static final byte MAX_STAT
See Also:
Constant Field Values

MIN_STAT

public static final byte MIN_STAT
See Also:
Constant Field Values

JITTER_STAT

public static final byte JITTER_STAT
See Also:
Constant Field Values

TIME_AVG_STAT

public static final byte TIME_AVG_STAT
Average value over time of collection. X / second.

See Also:
Constant Field Values
Constructor Detail

StatCollection

public StatCollection()
Method Detail

setMaxSamples

public void setMaxSamples(int maxSamples)
----------------------------------------------------------------- Maximum number of samples to store for each metric. Only necessary summaries are kept for calculating MAX/MIN/STDEV and average for those beyond the latest samples.


addMetricValue

public void addMetricValue(String metric,
                           double value)
-----------------------------------------------------------------


getMetrics

public Enumeration getMetrics()
-----------------------------------------------------------------

Returns:
The list of metric names.

getSamples

public Vector getSamples(String metric,
                         int samples)
-----------------------------------------------------------------


getMetricStat

public double getMetricStat(String metric,
                            int numSamples,
                            byte type)
                     throws IllegalArgumentException
-----------------------------------------------------------------

Parameters:
metric - The metric name.
numSamples - calculate over these # of latest samples
type - The type of metric.
Returns:
the value specified by type calculated over the last numSamples.
Throws:
IllegalArgumentException - invalid metric type or numSamples beyond the amount of data available.

getMetricStat

public double getMetricStat(String metric,
                            long startPeriod,
                            long endPeriod,
                            byte type)
                     throws IllegalArgumentException
----------------------------------------------------------------- byte MIN_STAT, MAX_STAT, AVG_STAT,

Throws:
IllegalArgumentException, - invalid type or metric name.
IllegalArgumentException

getLastSample

public double getLastSample(String metric)
----------------------------------------------------------------------

Throws:
IllegalArgumentException - the metric is not found.

main

public static void main(String[] args)
=====================================================================



For comments and suggestions please send e-mail to The NaradaBrokering Project