public class QDStats extends Object
Statistics can be gathered per different type
per set of values
.
Value for stat is calculated as a sum of all its children nodes.
Additionally, special "sum" nodes exist, that aggregate only values for the same
type. Sum nodes are used to accumulate values for closed stats and to aggregate similar type stats using
"alternative" hierarchy. Sum nodes are created for each type
and propagated up to the stat's root.
Getting value from the sum node would aggregate only similar type stats and can be more meaningful.
Consider the following stats example:
Any Box={name=BigBox} Box={name=Box1} Apple={name=apple1} Orange={name=orange1} Box={name=Box2} Apple={name=apple2} Orange={name=orange2} #Apple{sum} #Orange{sum} #Apple{sum} #Orange{sum}
In the example above box stats contain 2 other boxes keeping apples and oranges. When getting value from any
of the box would aggregate statistics for all fruits. Additionally, sum nodes are created for Apple
and
Orange
types and it is possible to calculate stats only for apples or oranges.
Boxes inside a box represent the "same" type hierarchy, so no sum node is needed and if either "Box1" or
"box2" would be closed then its stats would be accumulated in the "BigBox".
Use with caution! This API is old and has contradictory contract due to backward compatibility and therefore is subject to change in the future.
Modifier and Type | Class and Description |
---|---|
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.
|
Modifier and Type | Field and Description |
---|---|
protected static QDStats[] |
EMPTY_CHILDREN |
static int |
FLAG_COLLECTION_OF_ANYTHING
Deprecated.
|
static int |
FLAG_COLLECTION_OF_SELF
Deprecated.
|
static int |
FLAG_COUNT |
static int |
FLAG_IO |
static int |
FLAG_MEM |
static int |
FLAG_RID |
protected static int |
IO_EXTRA |
protected static int |
IO_STRIDE |
protected static int |
KIND_ADDED |
protected static int |
KIND_CHANGED |
protected static int |
KIND_FILTERED |
protected static int |
KIND_IO_DATA_READ_LAGS |
protected static int |
KIND_IO_DATA_READ_RECORDS |
protected static int |
KIND_IO_DATA_WRITE_LAGS |
protected static int |
KIND_IO_DATA_WRITE_RECORDS |
protected static int |
KIND_IO_READ_BYTES |
protected static int |
KIND_IO_READ_RTTS |
protected static int |
KIND_IO_SUB_READ_RECORDS |
protected static int |
KIND_IO_SUB_WRITE_RECORDS |
protected static int |
KIND_IO_WRITE_BYTES |
protected static int |
KIND_IO_WRITE_RTTS |
protected static int |
KIND_REMOVED |
protected static int |
KIND_SIZE |
protected static int |
MEM_EXTRA |
protected static int |
MEM_STRIDE |
static QDStats |
VOID
The instance of QDStats that is always empty.
|
Constructor and Description |
---|
QDStats()
Creates uninitialized stats.
|
QDStats(QDStats.SType type)
Creates root stats with a given
type . |
QDStats(QDStats.SType type,
DataScheme scheme)
Creates root stats with a given
type and scheme . |
QDStats(String keyProperties)
Creates uninitialized stats with a specified key properties.
|
Modifier and Type | Method and Description |
---|---|
protected int |
addChild(QDStats child) |
protected void |
addClosedStats(QDStats child) |
void |
addMBean(String type,
Object mbean) |
void |
addValues(QDStats.SValue value,
boolean localOnly,
long[] dest) |
void |
close() |
protected void |
closeChildren() |
protected void |
closeImpl() |
protected void |
closeInternal() |
protected void |
closeStats() |
QDStats |
create(QDStats.SType type)
Creates and returns new child with the corresponding type.
|
QDStats |
create(QDStats.SType type,
String keyProperties)
Creates and returns new child with the corresponding type and key properties.
|
QDStats |
create(QDStats.SType type,
String keyProperties,
boolean useRid)
Creates and returns new child with the corresponding type, key properties,
and an optional per-record tracking of stats.
|
protected QDStats |
createInternal(QDStats.SType type,
String keyProperties,
boolean isSum,
int ridCount,
DataScheme scheme) |
static QDStats |
createNamedVoid(String keyProperties)
|
QDStats |
get(QDStats.SType type)
Returns the first found child with the specified type or
null if not found. |
QDStats |
get(QDStats.SType type,
String keyProperties)
Returns the first found child with the corresponding type and key properties or
null if not found. |
List<QDStats> |
getAll(QDStats.SType type)
Returns all children with the corresponding type.
|
protected QDStats[] |
getChildren() |
String |
getFullKeyProperties()
Returns full key properties including all parents starting from oldest ones.
|
String |
getKeyProperties()
Returns key properties that are specific to this particular instance of QDStats as
they were specified during initialization of this instance.
|
protected Object |
getLock() |
QDStats |
getOrCreate(QDStats.SType type)
Returns the first found child with the corresponding type or
creates new
one if not found. |
QDStats |
getOrCreate(QDStats.SType type,
String keyProperties)
Returns the first found child with the corresponding type and key properties or
creates new one if not found. |
protected QDStats |
getOrCreateSum(QDStats.SType type) |
QDStats |
getOrVoid(QDStats.SType type)
Returns first found child with the corresponding type or
VOID if not found. |
protected QDStats |
getParent() |
int |
getRidCount() |
DataScheme |
getScheme() |
QDStats.SType |
getType()
Returns type of this statistics instance.
|
long |
getValue(QDStats.SValue value) |
long |
getValue(QDStats.SValue value,
boolean localOnly) |
protected void |
initChild(QDStats child,
QDStats.SType type,
String keyProperties,
int ridCount,
DataScheme scheme) |
void |
initRoot(QDStats.SType type,
DataScheme scheme)
Initializes root statistics after instantiation using no-arg constructor.
|
void |
initRoot(QDStats.SType type,
int ridCount)
Deprecated.
Use
initRoot(SType, DataScheme) instead. |
protected void |
initStats(QDStats parent,
QDStats.StatsLock lock,
QDStats.SType type,
DataScheme scheme)
Deprecated.
|
protected boolean |
isSum() |
protected boolean |
isSumFor(QDStats child) |
protected QDStats |
newInstance(QDStats.SType type,
boolean unmanaged) |
static String |
quoteKeyPropertyValue(String value)
Deprecated.
Use
JMXNameBuilder.quoteKeyPropertyValue(String) |
protected void |
removeChild(QDStats child,
int childIndex) |
String |
toDebugString() |
String |
toString() |
void |
updateAdded(int rid) |
void |
updateChanged(int rid) |
void |
updateFiltered(int rid) |
void |
updateIOReadBytes(long bytes) |
void |
updateIOReadDataLags(long sumLag) |
void |
updateIOReadDataRecord() |
void |
updateIOReadRecordBytes(int rid,
long bytes) |
void |
updateIOReadRtts(int rtt) |
void |
updateIOReadSubRecord() |
void |
updateIOWriteBytes(long bytes) |
void |
updateIOWriteDataLags(long sumLag) |
void |
updateIOWriteDataRecord() |
void |
updateIOWriteRecordBytes(int rid,
long bytes) |
void |
updateIOWriteRtts(int rtt) |
void |
updateIOWriteSubRecord() |
void |
updateRemoved(int rid) |
void |
updateRemoved(int rid,
int count) |
protected static final QDStats[] EMPTY_CHILDREN
public static final QDStats VOID
protected static final int KIND_ADDED
protected static final int KIND_CHANGED
protected static final int KIND_FILTERED
protected static final int KIND_REMOVED
protected static final int KIND_SIZE
protected static final int MEM_EXTRA
protected static final int MEM_STRIDE
protected static final int KIND_IO_READ_RTTS
protected static final int KIND_IO_WRITE_RTTS
protected static final int KIND_IO_SUB_READ_RECORDS
protected static final int KIND_IO_SUB_WRITE_RECORDS
protected static final int KIND_IO_DATA_READ_RECORDS
protected static final int KIND_IO_DATA_WRITE_RECORDS
protected static final int KIND_IO_DATA_READ_LAGS
protected static final int KIND_IO_DATA_WRITE_LAGS
protected static final int KIND_IO_READ_BYTES
protected static final int KIND_IO_WRITE_BYTES
protected static final int IO_EXTRA
protected static final int IO_STRIDE
public static final int FLAG_MEM
public static final int FLAG_IO
public static final int FLAG_RID
@Deprecated public static final int FLAG_COLLECTION_OF_ANYTHING
@Deprecated public static final int FLAG_COLLECTION_OF_SELF
public static final int FLAG_COUNT
public QDStats()
initRoot(com.devexperts.qd.stats.QDStats.SType, int)
must be called after construction.public QDStats(String keyProperties)
initRoot(com.devexperts.qd.stats.QDStats.SType, int)
must be called after construction.IllegalArgumentException
- if key properties have invalid format.public QDStats(QDStats.SType type)
type
.public QDStats(QDStats.SType type, DataScheme scheme)
type
and scheme
.protected QDStats getParent()
protected Object getLock()
public QDStats.SType getType()
public int getRidCount()
public DataScheme getScheme()
protected QDStats[] getChildren()
public String getKeyProperties()
getFullKeyProperties()
if you need a complete key properties, including
properties inherited from parent stats.public String getFullKeyProperties()
protected boolean isSum()
protected boolean isSumFor(QDStats child)
@Deprecated protected void initStats(QDStats parent, QDStats.StatsLock lock, QDStats.SType type, DataScheme scheme)
protected void closeStats()
protected void addClosedStats(QDStats child)
protected int addChild(QDStats child)
protected void removeChild(QDStats child, int childIndex)
protected void closeChildren()
protected QDStats newInstance(QDStats.SType type, boolean unmanaged)
protected QDStats createInternal(QDStats.SType type, String keyProperties, boolean isSum, int ridCount, DataScheme scheme)
protected QDStats getOrCreateSum(QDStats.SType type)
protected void closeInternal()
protected void initChild(QDStats child, QDStats.SType type, String keyProperties, int ridCount, DataScheme scheme)
public final void updateIOReadBytes(long bytes)
public final void updateIOReadRecordBytes(int rid, long bytes)
public final void updateIOReadSubRecord()
public final void updateIOReadDataRecord()
public final void updateIOReadRtts(int rtt)
public final void updateIOReadDataLags(long sumLag)
public final void updateIOWriteBytes(long bytes)
public final void updateIOWriteRecordBytes(int rid, long bytes)
public final void updateIOWriteSubRecord()
public final void updateIOWriteDataRecord()
public final void updateIOWriteRtts(int rtt)
public final void updateIOWriteDataLags(long sumLag)
public final void updateAdded(int rid)
public final void updateChanged(int rid)
public final void updateFiltered(int rid)
public final void updateRemoved(int rid)
public final void updateRemoved(int rid, int count)
public long getValue(QDStats.SValue value)
public long getValue(QDStats.SValue value, boolean localOnly)
public void addValues(QDStats.SValue value, boolean localOnly, long[] dest)
@Deprecated public void initRoot(QDStats.SType type, int ridCount)
initRoot(SType, DataScheme)
instead.public void initRoot(QDStats.SType type, DataScheme scheme)
public QDStats get(QDStats.SType type)
null
if not found.public QDStats get(QDStats.SType type, String keyProperties)
null
if not found.public List<QDStats> getAll(QDStats.SType type)
public QDStats getOrCreate(QDStats.SType type)
public QDStats getOrCreate(QDStats.SType type, String keyProperties)
public QDStats getOrVoid(QDStats.SType type)
VOID
if not found.public final QDStats create(QDStats.SType type)
VOID
for closed or void stats.public final QDStats create(QDStats.SType type, String keyProperties)
VOID
for closed or void stats.type
- The type of this stat.keyProperties
- The JMX key=value list of properties for naming of JMX beans (when JMX stats are used).public QDStats create(QDStats.SType type, String keyProperties, boolean useRid)
VOID
for closed or void stats.type
- The type of this stat.keyProperties
- The JMX key=value list of properties for naming of JMX beans (when JMX stats are used).useRid
- when true, then per-record stats tracking is inherited from parent, when false it is turned off
in the created stats and in all its children.public void close()
protected void closeImpl()
public static String quoteKeyPropertyValue(String value)
JMXNameBuilder.quoteKeyPropertyValue(String)
keyProperties
of
create(type, keyProperties)
.public String toDebugString()
Copyright © 2002–2025 Devexperts LLC. All rights reserved.