Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr
Class RepositoryStatistics.MetricHistory

    java.lang.Object
      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.)

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

### RepositoryStatistics.MetricHistory

    protected RepositoryStatistics.MetricHistory()

Method Detail

### recordStatisticsForLastSecond

    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.

  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 RepositoryStatistics.Statistics[] getHistory(Window window)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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