com.sun.sgs.impl.profile
Class ProfileConsumerImpl

java.lang.Object
  extended by com.sun.sgs.impl.profile.ProfileConsumerImpl
All Implemented Interfaces:
ProfileConsumer

 class ProfileConsumerImpl
extends Object
implements ProfileConsumer

This simple implementation of ProfileConsumer reports all data to a backing ProfileCollectorImpl.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.sgs.profile.ProfileConsumer
ProfileConsumer.ProfileDataType
 
Field Summary
static int DEFAULT_SAMPLE_AGGREGATE_CAPACITY
          The default aggregate sample capacity.
static double DEFAULT_SAMPLE_AGGREGATE_SMOOTHING
          The default aggregate sample smoothing capacity, for calculating the exponential weighted average of the samples.
 
Constructor Summary
ProfileConsumerImpl(ProfileCollectorImpl profileCollector, String name)
          Creates an instance of ProfileConsumerImpl.
 
Method Summary
 ProfileCounter createCounter(String name, ProfileConsumer.ProfileDataType type, ProfileCollector.ProfileLevel minLevel)
          Creates the named counter in this consumer.
 ProfileOperation createOperation(String name, ProfileConsumer.ProfileDataType type, ProfileCollector.ProfileLevel minLevel)
          Creates the named operation in this consumer.
 ProfileSample createSample(String name, ProfileConsumer.ProfileDataType type, ProfileCollector.ProfileLevel minLevel)
          Creates the named sample collection in this consumer.
 String getName()
          The profile consumer's unique name.
(package private)  Collection<ProfileOperation> getOperations()
          Package private method to access all operations.
 ProfileCollector.ProfileLevel getProfileLevel()
          Get the local profiling level for this consumer.
 void setProfileLevel(ProfileCollector.ProfileLevel level)
          Set the local profiling level for this consumer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SAMPLE_AGGREGATE_CAPACITY

public static final int DEFAULT_SAMPLE_AGGREGATE_CAPACITY
The default aggregate sample capacity.

See Also:
Constant Field Values

DEFAULT_SAMPLE_AGGREGATE_SMOOTHING

public static final double DEFAULT_SAMPLE_AGGREGATE_SMOOTHING
The default aggregate sample smoothing capacity, for calculating the exponential weighted average of the samples.

See Also:
Constant Field Values
Constructor Detail

ProfileConsumerImpl

ProfileConsumerImpl(ProfileCollectorImpl profileCollector,
                    String name)
Creates an instance of ProfileConsumerImpl.

Parameters:
profileCollector - the backing ProfileCollectorImpl
name - an identifier for this consumer
Method Detail

getProfileLevel

public ProfileCollector.ProfileLevel getProfileLevel()
Get the local profiling level for this consumer. Defaults to the value of ProfileCollector.getDefaultProfileLevel().

Specified by:
getProfileLevel in interface ProfileConsumer
Returns:
the profiling level

setProfileLevel

public void setProfileLevel(ProfileCollector.ProfileLevel level)
Set the local profiling level for this consumer. Setting the global profiling level via ProfileCollector.setDefaultProfileLevel(ProfileLevel) will override this value.

Specified by:
setProfileLevel in interface ProfileConsumer
Parameters:
level - the profiling level

createOperation

public ProfileOperation createOperation(String name,
                                        ProfileConsumer.ProfileDataType type,
                                        ProfileCollector.ProfileLevel minLevel)
Creates the named operation in this consumer. If an operation has already been created by this consumer with the same name, type and minLevel, it is returned.

Specified by:
createOperation in interface ProfileConsumer
Parameters:
name - the name of the operation
type - the type of operation to create
minLevel - the minimum level of profiling that must be set to report this operation
Returns:
a ProfileOperation to note operations

createCounter

public ProfileCounter createCounter(String name,
                                    ProfileConsumer.ProfileDataType type,
                                    ProfileCollector.ProfileLevel minLevel)
Creates the named counter in this consumer. If a counter has already been created by this consumer with the same name, type and minLevel, it is returned.

Specified by:
createCounter in interface ProfileConsumer
Parameters:
name - the name of the counter
type - the type of counter to create
minLevel - the minimum level of profiling that must be set to update this counter
Returns:
a ProfileCounter

createSample

public ProfileSample createSample(String name,
                                  ProfileConsumer.ProfileDataType type,
                                  ProfileCollector.ProfileLevel minLevel)
Creates the named sample collection in this consumer. If a sample has already been created by this consumer with the same name, type, and minLevel, it is returned.

The default capacity of the created ProfileSample is 0 and can be modified by calling AggregateProfileSample.setCapacity(int).

These samples use an exponential weighted average to calculate their averages. The default smoothing factor for the aggregate sample is 0.7 and can be modified by calling AggregateProfileSample.setSmoothingFactor(double).

Specified by:
createSample in interface ProfileConsumer
Parameters:
name - a name or description of the sample collection
type - the type of sample collection to create
minLevel - the minimum level of profiling that must be set to record this sample
Returns:
a ProfileSample that collects long data

getName

public String getName()
The profile consumer's unique name.

Specified by:
getName in interface ProfileConsumer
Returns:
the name of this consumer

getOperations

Collection<ProfileOperation> getOperations()
Package private method to access all operations. Used by the ProfileCollector.

Returns:
a snapshot of the registered operations

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