ModeShape Distribution 3.0.0.Beta4

Class RepositoryStatistics.MetricHistory

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

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.)

Constructor Summary
protected RepositoryStatistics.MetricHistory()
Method Summary
protected  RepositoryStatistics.Statistics[] getHistory(Window window)
protected  Window recordStatisticsForLastSecond(RepositoryStatistics.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

Constructor Detail


protected RepositoryStatistics.MetricHistory()
Method Detail


protected Window recordStatisticsForLastSecond(RepositoryStatistics.Statistics stats)
This method should be called by the 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 null
the largest window that was modified; never null


protected RepositoryStatistics.Statistics[] getHistory(Window window)

ModeShape Distribution 3.0.0.Beta4

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