001: /*
002: * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: package sun.tools.jconsole;
026:
027: import java.lang.management.MemoryUsage;
028:
029: public class MemoryPoolStat {
030: private String poolName;
031: private long usageThreshold;
032: private MemoryUsage usage;
033: private long lastGcId;
034: private long lastGcStartTime;
035: private long lastGcEndTime;
036: private long collectThreshold;
037: private MemoryUsage beforeGcUsage;
038: private MemoryUsage afterGcUsage;
039:
040: MemoryPoolStat(String name, long usageThreshold, MemoryUsage usage,
041: long lastGcId, long lastGcStartTime, long lastGcEndTime,
042: long collectThreshold, MemoryUsage beforeGcUsage,
043: MemoryUsage afterGcUsage) {
044: this .poolName = name;
045: this .usageThreshold = usageThreshold;
046: this .usage = usage;
047: this .lastGcId = lastGcId;
048: this .lastGcStartTime = lastGcStartTime;
049: this .lastGcEndTime = lastGcEndTime;
050: this .collectThreshold = collectThreshold;
051: this .beforeGcUsage = beforeGcUsage;
052: this .afterGcUsage = afterGcUsage;
053: }
054:
055: /**
056: * Returns the memory pool name.
057: */
058: public String getPoolName() {
059: return poolName;
060: }
061:
062: /**
063: * Returns the current memory usage.
064: */
065: public MemoryUsage getUsage() {
066: return usage;
067: }
068:
069: /**
070: * Returns the current usage threshold.
071: * -1 if not supported.
072: */
073: public long getUsageThreshold() {
074: return usageThreshold;
075: }
076:
077: /**
078: * Returns the current collection usage threshold.
079: * -1 if not supported.
080: */
081: public long getCollectionUsageThreshold() {
082: return collectThreshold;
083: }
084:
085: /**
086: * Returns the Id of GC.
087: */
088: public long getLastGcId() {
089: return lastGcId;
090: }
091:
092: /**
093: * Returns the start time of the most recent GC on
094: * the memory pool for this statistics in milliseconds.
095: *
096: * Return 0 if no GC occurs.
097: */
098: public long getLastGcStartTime() {
099: return lastGcStartTime;
100: }
101:
102: /**
103: * Returns the end time of the most recent GC on
104: * the memory pool for this statistics in milliseconds.
105: *
106: * Return 0 if no GC occurs.
107: */
108: public long getLastGcEndTime() {
109: return lastGcEndTime;
110: }
111:
112: /**
113: * Returns the memory usage before the most recent GC started.
114: * null if no GC occurs.
115: */
116: public MemoryUsage getBeforeGcUsage() {
117: return beforeGcUsage;
118: }
119:
120: /**
121: * Returns the memory usage after the most recent GC finished.
122: * null if no GC occurs.
123: */
124: public MemoryUsage getAfterGcUsage() {
125: return beforeGcUsage;
126: }
127: }
|