com.sleepycat.je.utilint
Class StatGroup

java.lang.Object
  extended by com.sleepycat.je.utilint.StatGroup
All Implemented Interfaces:
Serializable

public class StatGroup
extends Object
implements Serializable

The Stats infrastructure provides context for JE statistics. Each statistic has these attributes: - metadata - specifically, a name and description - each statistic is associated with a parent stat group, which itself has a name and description. - support for the StatsConfig.clear semantics - a way to print statistics in a user friendly way. To create a statistic variable, instantiate one of the concrete subclasses of Stat. Each concrete subclass should hold the methods that are needed to best set and display the value. For example, instead of using LongStat to hold a timestamp or LSN value, use TimestampStat or LSNStat. A Stat instance needs to specify a StatDefinition. There may be multiple Stat variables in different components that share a StatDefinition. They are differentiated when displayed by their parent StatGroup. Each Stat instance is associated with a StatGroup, which holds the collection of stats that belong to a given component. Each member of the StatGroup has a unique StatDefinition. StatGroups can be combined, in order to accumulate values. For example, the LockManager may have multiple lock tables. Each lock table keeps its own latch statistics. When LockStats are generated, the StatsGroup for each latch is collected and rolled up into a single StatGroup, using the addAll(StatGroup) method. The Stats infrastructure is for internal use only. Public API classes like EnvironmentStats, LockStats, etc, contain StatGroups. A call to retrieve stats is implementing by getting a clone of the StatGroups held by the components like the cleaner, the incompressor, the LockManager, etc. The public API classes provide getter methods that reach into the StatGroups to return the specific stat value. To add a statistic, create the Stat variable in the component where it is being used and associate it with a StatGroup. The Stat infrastruture does the rest of the work for plumbing that statistic up to the public API class. Each API class must provide a getter method to access the specific statistic. Currenly, this is done manually.

See Also:
Serialized Form

Constructor Summary
StatGroup(String groupName, String groupDescription)
           
 
Method Summary
 void addAll(StatGroup other)
          Add all the stats from the other group into this group.
 void addToTipMap(Map<String,String> tips)
           
 void clear()
          Clear all stats in a StatGroup.
 StatGroup cloneGroup(boolean clear)
           
 TransactionStats.Active[] getActiveTxnArray(StatDefinition definition)
           
 Long getAtomicLong(StatDefinition definition)
           
 boolean getBoolean(StatDefinition definition)
           
 String getDescription()
           
 int getInt(StatDefinition definition)
           
 long getLong(StatDefinition definition)
           
 long[] getLongArray(StatDefinition definition)
           
 LongStat getLongStat(StatDefinition definition)
           
 String getName()
           
 String getString(StatDefinition definition)
           
(package private)  void register(Stat<?> oneStat)
          Add a stat to the group.
 String toString()
           
 String toStringVerbose()
          Includes the per-stat description in the output string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatGroup

public StatGroup(String groupName,
                 String groupDescription)
Method Detail

register

void register(Stat<?> oneStat)
Add a stat to the group. User is responsible for serializing calls to register().


addAll

public void addAll(StatGroup other)
Add all the stats from the other group into this group. If both groups have the same stat, add the values.


clear

public void clear()
Clear all stats in a StatGroup.


getName

public String getName()

getDescription

public String getDescription()

cloneGroup

public StatGroup cloneGroup(boolean clear)
Returns:
a Stats class that copies the value of all stats in the group

getInt

public int getInt(StatDefinition definition)

getLongStat

public LongStat getLongStat(StatDefinition definition)

getLong

public long getLong(StatDefinition definition)

getAtomicLong

public Long getAtomicLong(StatDefinition definition)

getActiveTxnArray

public TransactionStats.Active[] getActiveTxnArray(StatDefinition definition)

getLongArray

public long[] getLongArray(StatDefinition definition)

getBoolean

public boolean getBoolean(StatDefinition definition)

getString

public String getString(StatDefinition definition)

addToTipMap

public void addToTipMap(Map<String,String> tips)

toString

public String toString()
Overrides:
toString in class Object

toStringVerbose

public String toStringVerbose()
Includes the per-stat description in the output string.



Copyright (c) 2004-2010 Oracle. All rights reserved.