|
1 /* |
|
2 * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Sun designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Sun in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 * have any questions. |
|
24 */ |
|
25 package sun.tools.jconsole; |
|
26 |
|
27 import java.lang.management.MemoryUsage; |
|
28 |
|
29 public class MemoryPoolStat { |
|
30 private String poolName; |
|
31 private long usageThreshold; |
|
32 private MemoryUsage usage; |
|
33 private long lastGcId; |
|
34 private long lastGcStartTime; |
|
35 private long lastGcEndTime; |
|
36 private long collectThreshold; |
|
37 private MemoryUsage beforeGcUsage; |
|
38 private MemoryUsage afterGcUsage; |
|
39 |
|
40 MemoryPoolStat(String name, |
|
41 long usageThreshold, |
|
42 MemoryUsage usage, |
|
43 long lastGcId, |
|
44 long lastGcStartTime, |
|
45 long lastGcEndTime, |
|
46 long collectThreshold, |
|
47 MemoryUsage beforeGcUsage, |
|
48 MemoryUsage afterGcUsage) { |
|
49 this.poolName = name; |
|
50 this.usageThreshold = usageThreshold; |
|
51 this.usage = usage; |
|
52 this.lastGcId = lastGcId; |
|
53 this.lastGcStartTime = lastGcStartTime; |
|
54 this.lastGcEndTime = lastGcEndTime; |
|
55 this.collectThreshold = collectThreshold; |
|
56 this.beforeGcUsage = beforeGcUsage; |
|
57 this.afterGcUsage = afterGcUsage; |
|
58 } |
|
59 |
|
60 /** |
|
61 * Returns the memory pool name. |
|
62 */ |
|
63 public String getPoolName() { |
|
64 return poolName; |
|
65 } |
|
66 |
|
67 /** |
|
68 * Returns the current memory usage. |
|
69 */ |
|
70 public MemoryUsage getUsage() { |
|
71 return usage; |
|
72 } |
|
73 |
|
74 /** |
|
75 * Returns the current usage threshold. |
|
76 * -1 if not supported. |
|
77 */ |
|
78 public long getUsageThreshold() { |
|
79 return usageThreshold; |
|
80 } |
|
81 |
|
82 /** |
|
83 * Returns the current collection usage threshold. |
|
84 * -1 if not supported. |
|
85 */ |
|
86 public long getCollectionUsageThreshold() { |
|
87 return collectThreshold; |
|
88 } |
|
89 |
|
90 /** |
|
91 * Returns the Id of GC. |
|
92 */ |
|
93 public long getLastGcId() { |
|
94 return lastGcId; |
|
95 } |
|
96 |
|
97 |
|
98 /** |
|
99 * Returns the start time of the most recent GC on |
|
100 * the memory pool for this statistics in milliseconds. |
|
101 * |
|
102 * Return 0 if no GC occurs. |
|
103 */ |
|
104 public long getLastGcStartTime() { |
|
105 return lastGcStartTime; |
|
106 } |
|
107 |
|
108 /** |
|
109 * Returns the end time of the most recent GC on |
|
110 * the memory pool for this statistics in milliseconds. |
|
111 * |
|
112 * Return 0 if no GC occurs. |
|
113 */ |
|
114 public long getLastGcEndTime() { |
|
115 return lastGcEndTime; |
|
116 } |
|
117 |
|
118 /** |
|
119 * Returns the memory usage before the most recent GC started. |
|
120 * null if no GC occurs. |
|
121 */ |
|
122 public MemoryUsage getBeforeGcUsage() { |
|
123 return beforeGcUsage; |
|
124 } |
|
125 |
|
126 /** |
|
127 * Returns the memory usage after the most recent GC finished. |
|
128 * null if no GC occurs. |
|
129 */ |
|
130 public MemoryUsage getAfterGcUsage() { |
|
131 return beforeGcUsage; |
|
132 } |
|
133 } |