com.sun.btrace
Class BTraceUtils.Aggregations

java.lang.Object
  extended by com.sun.btrace.BTraceUtils.Aggregations
Enclosing class:
BTraceUtils

public static class BTraceUtils.Aggregations
extends java.lang.Object


Constructor Summary
BTraceUtils.Aggregations()
           
 
Method Summary
static void addToAggregation(Aggregation aggregation, AggregationKey key, long value)
          Adds a value to the aggregation with a grouping key.
static void addToAggregation(Aggregation aggregation, long value)
          Adds a value to the aggregation with no grouping key.
static void clearAggregation(Aggregation aggregation)
          Resets values within the aggregation to the default.
static Aggregation newAggregation(AggregationFunction type)
          Creates a new aggregation based on the given aggregation function type.
static AggregationKey newAggregationKey(java.lang.Object element1)
          Creates a grouping aggregation key with the provided value.
static AggregationKey newAggregationKey(java.lang.Object element1, java.lang.Object element2)
          Creates a composite grouping aggregation key with the provided values.
static AggregationKey newAggregationKey(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3)
          Creates a composite grouping aggregation key with the provided values.
static AggregationKey newAggregationKey(java.lang.Object element1, java.lang.Object element2, java.lang.Object element3, java.lang.Object element4)
          Creates a composite grouping aggregation key with the provided values.
static void printAggregation(java.lang.String name, Aggregation aggregation)
           
static void printAggregation(java.lang.String name, Aggregation aggregation, java.lang.String format)
           
static void printAggregation(java.lang.String name, java.lang.String format, java.util.Collection<Aggregation> aggregationList)
           
static void truncateAggregation(Aggregation aggregation, int count)
          Removes all aggregated values from the aggregation except for the largest or smallest abs(count) elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTraceUtils.Aggregations

public BTraceUtils.Aggregations()
Method Detail

newAggregation

public static Aggregation newAggregation(AggregationFunction type)
Creates a new aggregation based on the given aggregation function type.

Parameters:
type - the aggregating function to be performed on the data being added to the aggregation.

newAggregationKey

public static AggregationKey newAggregationKey(java.lang.Object element1)
Creates a grouping aggregation key with the provided value. The value must be a String or Number type.

Parameters:
element1 - the value of the aggregation key

newAggregationKey

public static AggregationKey newAggregationKey(java.lang.Object element1,
                                               java.lang.Object element2)
Creates a composite grouping aggregation key with the provided values. The values must be String or Number types.

Parameters:
element1 - the first element of the composite aggregation key
element2 - the second element of the composite aggregation key

newAggregationKey

public static AggregationKey newAggregationKey(java.lang.Object element1,
                                               java.lang.Object element2,
                                               java.lang.Object element3)
Creates a composite grouping aggregation key with the provided values. The values must be String or Number types.

Parameters:
element1 - the first element of the composite aggregation key
element2 - the second element of the composite aggregation key
element3 - the third element of the composite aggregation key

newAggregationKey

public static AggregationKey newAggregationKey(java.lang.Object element1,
                                               java.lang.Object element2,
                                               java.lang.Object element3,
                                               java.lang.Object element4)
Creates a composite grouping aggregation key with the provided values. The values must be String or Number types.

Parameters:
element1 - the first element of the composite aggregation key
element2 - the second element of the composite aggregation key
element3 - the third element of the composite aggregation key
element4 - the fourth element of the composite aggregation key

addToAggregation

public static void addToAggregation(Aggregation aggregation,
                                    long value)
Adds a value to the aggregation with no grouping key. This method should be used when the aggregation is to calculate only a single aggregated value.

Parameters:
aggregation - the aggregation to which the value should be added

addToAggregation

public static void addToAggregation(Aggregation aggregation,
                                    AggregationKey key,
                                    long value)
Adds a value to the aggregation with a grouping key. This method should be used when the aggregation should effectively perform a "group by" on the key value. The aggregation will calculate a separate aggregated value for each unique aggregation key.

Parameters:
aggregation - the aggregation to which the value should be added
key - the grouping aggregation key

clearAggregation

public static void clearAggregation(Aggregation aggregation)
Resets values within the aggregation to the default. This will affect all values within the aggregation when multiple aggregation keys have been used.

Parameters:
aggregation - the aggregation to be cleared

truncateAggregation

public static void truncateAggregation(Aggregation aggregation,
                                       int count)
Removes all aggregated values from the aggregation except for the largest or smallest abs(count) elements.

If count is positive, the largest aggregated values in the aggregation will be preserved. If count is negative the smallest values will be preserved. If count is zero then all elements will be removed.

Behavior is intended to be similar to the dtrace trunc() function.

Parameters:
aggregation - the aggregation to be truncated
count - the number of elements to preserve. If negative, the smallest abs(count) elements are preserved.

printAggregation

public static void printAggregation(java.lang.String name,
                                    Aggregation aggregation)

printAggregation

public static void printAggregation(java.lang.String name,
                                    Aggregation aggregation,
                                    java.lang.String format)

printAggregation

public static void printAggregation(java.lang.String name,
                                    java.lang.String format,
                                    java.util.Collection<Aggregation> aggregationList)