com.devexperts.qd.stats
Class QDStats

java.lang.Object
  extended by com.devexperts.qd.stats.QDStats
Direct Known Subclasses:
JMXStats

public class QDStats
extends java.lang.Object

Statistics gathering delegate.


Nested Class Summary
protected static class QDStats.StatsLock
           
static class QDStats.SType
          Defines specific statistic type, including its name.
static class QDStats.SValue
          Defines specific statistic value, including its name and address.
 
Field Summary
protected static QDStats[] EMPTY_CHILDREN
           
static int FLAG_COLLECTION_OF_ANYTHING
           
static int FLAG_COLLECTION_OF_SELF
           
static int FLAG_COUNT
           
static int FLAG_IO
           
static int FLAG_RID
           
protected static int GROUP_IO_READ
           
protected static int GROUP_IO_WRITE
           
protected static int GROUP_RID
           
protected static int KIND_ADDED
           
protected static int KIND_CHANGED
           
protected static int KIND_FILTERED
           
protected static int KIND_IO_BYTES
           
protected static int KIND_IO_CALLS
           
protected static int KIND_REMOVED
           
protected static int KIND_SIZE
           
static QDStats VOID
          The instance of QDStats that is always empty.
 
Constructor Summary
QDStats()
          Creates unitialized stats.
QDStats(QDStats.SType type)
          Creates root stats with given type.
QDStats(QDStats.SType type, DataScheme scheme)
           
QDStats(QDStats.SType type, int rid_count)
          Deprecated. Use QDStats(com.devexperts.qd.stats.QDStats.SType, com.devexperts.qd.DataScheme) instead.
 
Method Summary
protected  void addChild(QDStats child)
           
protected  void addClosedStats(QDStats child)
           
 void addMBean(java.lang.String type, java.lang.Object mbean)
           
 void addValues(QDStats.SValue value, boolean local_only, int[] dest)
           
protected static int calculateBytes(int refs, int objs)
           
 void close()
           
protected  void closeChildren()
           
protected  boolean closeInternal(QDStats child)
           
protected  void closeStats()
           
 QDStats create(QDStats.SType type)
          Creates and returns new child with the corresponding type.
 QDStats create(QDStats.SType type, java.lang.String key_properties)
          Creates and returns new child with the corresponding type and key properties.
protected  QDStats createInternal(QDStats.SType type, java.lang.String key_properties, boolean sum_mode, int rid_count, DataScheme scheme)
           
static QDStats createNamedVoid(java.lang.String key_properties)
          Returns an instance of QDStats that does not actually track anything (is always empty like VOID but is named.
 QDStats get(QDStats.SType type)
          Returns first found child with the corresponding type or null if not found.
protected  QDStats[] getChildren()
           
 java.lang.String getKeyProperties()
           
protected  java.lang.Object getLock()
           
 QDStats getOrCreate(QDStats.SType type)
          Returns first found child with the corresponding type or creates new one if not found.
 QDStats getOrVoid(QDStats.SType type)
          Returns first found child with the corresponding type or VOID if not found.
protected  QDStats getParent()
           
protected  int getRidCount()
           
protected  DataScheme getScheme()
           
 QDStats.SType getType()
          Returns type of this statistics instance.
 int getValue(QDStats.SValue value)
           
 int getValue(QDStats.SValue value, boolean local_only)
           
protected  boolean hasSum(QDStats parent, QDStats child)
           
protected  void initChild(QDStats child, QDStats.SType type, java.lang.String key_properties, int rid_count, DataScheme scheme)
           
 void initRoot(QDStats.SType type, DataScheme scheme)
           
 void initRoot(QDStats.SType type, int rid_count)
          Deprecated. Use initRoot(com.devexperts.qd.stats.QDStats.SType, com.devexperts.qd.DataScheme) instead.
protected  void initStats(QDStats parent, QDStats.StatsLock lock, QDStats.SType type, DataScheme scheme)
           
protected  void initStats(QDStats parent, QDStats.StatsLock lock, QDStats.SType type, int rid_count)
          Deprecated.  
protected  boolean isSumMode()
           
protected  QDStats newInstance(QDStats.SType type)
           
static java.lang.String quoteKeyPropertyValue(java.lang.String value)
          Quotes key property value so that it can be safely used in key_properties of create(type, key_properties).
protected  boolean removeChild(QDStats child)
           
 void updateAdded(int rid)
           
 void updateChanged(int rid)
           
 void updateFiltered(int rid)
           
 void updateIORead(int bytes)
           
 void updateIOWrite(int bytes)
           
 void updateRemoved(int rid)
           
 void updateRemoved(int rid, int count)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VOID

public static final QDStats VOID
The instance of QDStats that is always empty.


GROUP_IO_READ

protected static final int GROUP_IO_READ
See Also:
Constant Field Values

GROUP_IO_WRITE

protected static final int GROUP_IO_WRITE
See Also:
Constant Field Values

GROUP_RID

protected static final int GROUP_RID
See Also:
Constant Field Values

KIND_IO_BYTES

protected static final int KIND_IO_BYTES
See Also:
Constant Field Values

KIND_IO_CALLS

protected static final int KIND_IO_CALLS
See Also:
Constant Field Values

KIND_ADDED

protected static final int KIND_ADDED
See Also:
Constant Field Values

KIND_CHANGED

protected static final int KIND_CHANGED
See Also:
Constant Field Values

KIND_FILTERED

protected static final int KIND_FILTERED
See Also:
Constant Field Values

KIND_REMOVED

protected static final int KIND_REMOVED
See Also:
Constant Field Values

KIND_SIZE

protected static final int KIND_SIZE
See Also:
Constant Field Values

FLAG_RID

public static final int FLAG_RID
See Also:
Constant Field Values

FLAG_IO

public static final int FLAG_IO
See Also:
Constant Field Values

FLAG_COLLECTION_OF_ANYTHING

public static final int FLAG_COLLECTION_OF_ANYTHING
See Also:
Constant Field Values

FLAG_COLLECTION_OF_SELF

public static final int FLAG_COLLECTION_OF_SELF
See Also:
Constant Field Values

FLAG_COUNT

public static final int FLAG_COUNT
See Also:
Constant Field Values

EMPTY_CHILDREN

protected static final QDStats[] EMPTY_CHILDREN
Constructor Detail

QDStats

public QDStats()
Creates unitialized stats. initRoot(com.devexperts.qd.stats.QDStats.SType, int) or initStats(com.devexperts.qd.stats.QDStats, com.devexperts.qd.stats.QDStats.StatsLock, com.devexperts.qd.stats.QDStats.SType, int) must be called after construction.


QDStats

public QDStats(QDStats.SType type)
Creates root stats with given type.


QDStats

public QDStats(QDStats.SType type,
               int rid_count)
Deprecated. Use QDStats(com.devexperts.qd.stats.QDStats.SType, com.devexperts.qd.DataScheme) instead.

Creates root stats with given type and rid_count.


QDStats

public QDStats(QDStats.SType type,
               DataScheme scheme)
Method Detail

createNamedVoid

public static QDStats createNamedVoid(java.lang.String key_properties)
Returns an instance of QDStats that does not actually track anything (is always empty like VOID but is named.


getParent

protected QDStats getParent()

getLock

protected java.lang.Object getLock()

getType

public QDStats.SType getType()
Returns type of this statistics instance.


getRidCount

protected int getRidCount()

getScheme

protected DataScheme getScheme()

getChildren

protected QDStats[] getChildren()

getKeyProperties

public java.lang.String getKeyProperties()

isSumMode

protected boolean isSumMode()

hasSum

protected boolean hasSum(QDStats parent,
                         QDStats child)

initStats

protected void initStats(QDStats parent,
                         QDStats.StatsLock lock,
                         QDStats.SType type,
                         int rid_count)
Deprecated. 


initStats

protected void initStats(QDStats parent,
                         QDStats.StatsLock lock,
                         QDStats.SType type,
                         DataScheme scheme)

closeStats

protected void closeStats()

addClosedStats

protected void addClosedStats(QDStats child)

addChild

protected void addChild(QDStats child)

removeChild

protected boolean removeChild(QDStats child)

closeChildren

protected void closeChildren()

newInstance

protected QDStats newInstance(QDStats.SType type)

createInternal

protected QDStats createInternal(QDStats.SType type,
                                 java.lang.String key_properties,
                                 boolean sum_mode,
                                 int rid_count,
                                 DataScheme scheme)

initChild

protected void initChild(QDStats child,
                         QDStats.SType type,
                         java.lang.String key_properties,
                         int rid_count,
                         DataScheme scheme)

closeInternal

protected boolean closeInternal(QDStats child)

calculateBytes

protected static int calculateBytes(int refs,
                                    int objs)

updateIORead

public final void updateIORead(int bytes)

updateIOWrite

public final void updateIOWrite(int bytes)

updateAdded

public final void updateAdded(int rid)

updateChanged

public final void updateChanged(int rid)

updateFiltered

public final void updateFiltered(int rid)

updateRemoved

public final void updateRemoved(int rid)

updateRemoved

public final void updateRemoved(int rid,
                                int count)

getValue

public int getValue(QDStats.SValue value,
                    boolean local_only)

addValues

public void addValues(QDStats.SValue value,
                      boolean local_only,
                      int[] dest)

getValue

public int getValue(QDStats.SValue value)

initRoot

public void initRoot(QDStats.SType type,
                     int rid_count)
Deprecated. Use initRoot(com.devexperts.qd.stats.QDStats.SType, com.devexperts.qd.DataScheme) instead.

Initializes root statistics after instantiation using no-arg constructor.


initRoot

public void initRoot(QDStats.SType type,
                     DataScheme scheme)

get

public QDStats get(QDStats.SType type)
Returns first found child with the corresponding type or null if not found.


getOrCreate

public QDStats getOrCreate(QDStats.SType type)
Returns first found child with the corresponding type or creates new one if not found.


getOrVoid

public QDStats getOrVoid(QDStats.SType type)
Returns first found child with the corresponding type or VOID if not found.


create

public final QDStats create(QDStats.SType type)
Creates and returns new child with the corresponding type.


create

public QDStats create(QDStats.SType type,
                      java.lang.String key_properties)
Creates and returns new child with the corresponding type and key properties.


close

public void close()

addMBean

public void addMBean(java.lang.String type,
                     java.lang.Object mbean)

quoteKeyPropertyValue

public static java.lang.String quoteKeyPropertyValue(java.lang.String value)
Quotes key property value so that it can be safely used in key_properties of create(type, key_properties).