ModeShape Distribution 3.5.0.Final

org.modeshape.jcr
Class RepositoryStatistics.MetricHistory

java.lang.Object
  extended by org.modeshape.jcr.RepositoryStatistics.MetricHistory
Direct Known Subclasses:
RepositoryStatistics.DurationHistory, RepositoryStatistics.ValueHistory
Enclosing class:
RepositoryStatistics

@ThreadSafe
protected abstract static class RepositoryStatistics.MetricHistory
extends Object

Abstract base class for the 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.)


Field Summary
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
           
 
Constructor Summary
protected RepositoryStatistics.MetricHistory()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_SECONDS

protected static final int MAX_SECONDS
See Also:
Constant Field Values

MAX_MINUTES

protected static final int MAX_MINUTES
See Also:
Constant Field Values

MAX_HOURS

protected static final int MAX_HOURS
See Also:
Constant Field Values

MAX_DAYS

protected static final int MAX_DAYS
See Also:
Constant Field Values

MAX_WEEKS

protected static final int MAX_WEEKS
See Also:
Constant Field Values
Constructor Detail

RepositoryStatistics.MetricHistory

protected RepositoryStatistics.MetricHistory()
Method Detail

recordStatisticsForLastSecond

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.

Parameters:
stats - the new statistics for the most recent second; may not be null
Returns:
the largest window that was modified; never null

getHistory

protected Statistics[] getHistory(Window window)

ModeShape Distribution 3.5.0.Final

Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.