com.sun.sgs.profile
Interface AggregateProfileSample

All Superinterfaces:
ProfileSample

public interface AggregateProfileSample
extends ProfileSample

A profile sample which is aggregated until explicitly cleared. Some simple statistics are gathered about the samples.

The samples and statistics can be cleared by calling clearSamples().

The capacity is the maxiumum number of samples that will be held. Once this limit is reached, older samples will be dropped to make room for the newest samples. The statistics are over all the gathered samples since creation or the last clearSamples call; thus, they might not reflect the current list returned by getSamples().


Method Summary
 void clearSamples()
          Clears the accumulated samples and their statistics.
 double getAverage()
          Returns the exponential weighted average of the added samples, using the smoothing factor as defined in setSmoothingFactor(double).
 int getCapacity()
          Returns the maximum number of samples this object can hold.
 long getMaxSample()
          Gets the maximum sample value added.
 long getMinSample()
          Gets the minimum sample value added.
 int getNumSamples()
          Returns the number of samples added, which will be a value between 0 and the current capacity.
 List<Long> getSamples()
          Returns a list of all added samples in the order they are added.
 double getSmoothingFactor()
          Gets the current smoothing factor in effect for calculating the average of the added samples.
 void setCapacity(int capacity)
          Sets the maximum number of samples this object can hold.
 void setSmoothingFactor(double smooth)
          Sets the smoothing factor used for calculating the average of the added samples.
 
Methods inherited from interface com.sun.sgs.profile.ProfileSample
addSample, getName
 

Method Detail

getSamples

List<Long> getSamples()
Returns a list of all added samples in the order they are added.

Returns:
all the samples

clearSamples

void clearSamples()
Clears the accumulated samples and their statistics.


getAverage

double getAverage()
Returns the exponential weighted average of the added samples, using the smoothing factor as defined in setSmoothingFactor(double). This value is undefined if no samples have been added.

Returns:
the average of the samples

getMaxSample

long getMaxSample()
Gets the maximum sample value added. This value is undefined if no samples have been added.

Returns:
the maximum sample

getMinSample

long getMinSample()
Gets the minimum sample value added. This value is undefined if no samples have been added.

Returns:
the minimum sample

getNumSamples

int getNumSamples()
Returns the number of samples added, which will be a value between 0 and the current capacity.

Returns:
the number of samples added

getCapacity

int getCapacity()
Returns the maximum number of samples this object can hold.

Returns:
the maximum number of samples

setCapacity

void setCapacity(int capacity)
Sets the maximum number of samples this object can hold. Once the limit of samples has been reached, older samples will be dropped to make room for the newest samples. Dropping samples due to capacity restrictions has no effect on the other aggregated statistics.

A limit of 0 indicates that no samples should be held, but the statistics should be gathered.

Parameters:
capacity - the maximum number of samples this object can hold
Throws:
IllegalArgumentException - if the capacity is negative

setSmoothingFactor

void setSmoothingFactor(double smooth)
Sets the smoothing factor used for calculating the average of the added samples. The smoothing factor must be a value between 0.0 and 1.0, inclusive.

A value closer to 1.0 provides less smoothing of the data, and more weight to recent data; a value closer to 0.0 provides more smoothing but is less responsive to recent changes.

Parameters:
smooth - the smoothing factor
Throws:
IllegalArgumentException - if smooth is not between 0.0 and 1.0, inclusive

getSmoothingFactor

double getSmoothingFactor()
Gets the current smoothing factor in effect for calculating the average of the added samples.

Returns:
the current smoothing factor

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved