@ThreadSafe protected abstract static class RepositoryStatistics.MetricHistory extends Object
RepositoryStatistics.ValueHistory
and RepositoryStatistics.DurationHistory
classes. This class tracks the statistics for
various periods of time, and to roll up the statistics. The design takes advantage of the fact that we know up front how
many statistics to keep for each window
, and uses a fixed-size array as a ring of ordered values. It also is
designed to minimize lock contention.
Each instance of this class consumes 5x4bytes for the integer couters, 5x8bytes for the references to the arrays, and 143x8byte references to the Statistics objects (for a total of 1204 bytes). Each Statistics instances consumes 36 bytes (1x4byte integer, 2x8byte longs, 2x8byte doubles), so 149 instances consumes 5364bytes. Thus the total memory required for a single MetricHistory instance is 6568 bytes (6.41kB).
So ten metrics require 64.1kB of memory, assuming the repository has been running for 52 weeks. (If not, then not all of the Statistics arrays will be filled.)
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_DAYS |
protected static int |
MAX_HOURS |
protected static int |
MAX_MINUTES |
protected static int |
MAX_SECONDS |
protected static int |
MAX_WEEKS |
Modifier | Constructor and Description |
---|---|
protected |
MetricHistory() |
Modifier and Type | Method and Description |
---|---|
protected Statistics[] |
getHistory(Window window) |
protected Window |
recordStatisticsForLastSecond(Statistics stats)
This method should be called by the
rollup() method with the statistics computed for the values/durations
since the last invocation. |
protected static final int MAX_SECONDS
protected static final int MAX_MINUTES
protected static final int MAX_HOURS
protected static final int MAX_DAYS
protected static final int MAX_WEEKS
protected Window recordStatisticsForLastSecond(Statistics stats)
rollup()
method with the statistics computed for the values/durations
since the last invocation.stats
- the new statistics for the most recent second; may not be nullprotected Statistics[] getHistory(Window window)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.