001: /*
002: * <copyright>
003: *
004: * Copyright 2001-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.core.service;
028:
029: /**
030: * This service provides metrics for recent persistence activity,
031: * such as the most recent snapshot size in bytes.
032: */
033: public interface PersistenceMetricsService {
034: interface Metric {
035: long getStartTime();
036:
037: long getEndTime();
038:
039: long getSize();
040:
041: long getCpuTime();
042:
043: boolean isFull();
044:
045: Throwable getException();
046:
047: String getName();
048:
049: Class getPersistencePluginClass();
050:
051: String getPersistencePluginName();
052:
053: int getPersistencePluginParamCount();
054:
055: String getPersistencePluginParam(int i);
056: }
057:
058: /**
059: * Designates that averaging should include only full
060: * snapshots
061: */
062: static final int FULL = 1;
063:
064: /**
065: * Designates that averaging should include only delta
066: * snapshots
067: */
068: static final int DELTA = 2;
069:
070: /**
071: * Designates that averaging should include all
072: * snapshots
073: */
074: static final int ALL = 3;
075:
076: static final int MAX_METRICS = 100;
077:
078: /**
079: * Get all retained metrics. The maximum number retained is
080: * currently a constant MAX_METRICS
081: * @param which one of the constants FULL, DELTA, ALL designating
082: * which kind of snapshots should be included.
083: */
084: Metric[] getAll(int which);
085:
086: /**
087: * Get the average of all metrics ever generated including the ones
088: * that have been dropped due to exceeding MAX_METRICS
089: * @param which one of the constants FULL, DELTA, ALL designating
090: * which kind of snapshots should be averaged.
091: */
092: Metric getAverage(int which);
093:
094: /**
095: * Get the count of all persistence snapshots taken (the denominator
096: * of the average).
097: * @return the count of all persistence snapshots taken.
098: * @param which one of the constants FULL, DELTA, ALL designating
099: * which kind of snapshots should be counted.
100: */
101: int getCount(int which);
102: }
|