author | ohair |
Tue, 25 May 2010 15:58:33 -0700 | |
changeset 5506 | 202f599c92aa |
parent 715 | f16baef3a20e |
child 12851 | 3334e1c781d0 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
25 |
|
2 | 26 |
package sun.tools.jconsole; |
27 |
||
28 |
import java.lang.management.MemoryUsage; |
|
29 |
||
30 |
public class MemoryPoolStat { |
|
31 |
private String poolName; |
|
32 |
private long usageThreshold; |
|
33 |
private MemoryUsage usage; |
|
34 |
private long lastGcId; |
|
35 |
private long lastGcStartTime; |
|
36 |
private long lastGcEndTime; |
|
37 |
private long collectThreshold; |
|
38 |
private MemoryUsage beforeGcUsage; |
|
39 |
private MemoryUsage afterGcUsage; |
|
40 |
||
41 |
MemoryPoolStat(String name, |
|
42 |
long usageThreshold, |
|
43 |
MemoryUsage usage, |
|
44 |
long lastGcId, |
|
45 |
long lastGcStartTime, |
|
46 |
long lastGcEndTime, |
|
47 |
long collectThreshold, |
|
48 |
MemoryUsage beforeGcUsage, |
|
49 |
MemoryUsage afterGcUsage) { |
|
50 |
this.poolName = name; |
|
51 |
this.usageThreshold = usageThreshold; |
|
52 |
this.usage = usage; |
|
53 |
this.lastGcId = lastGcId; |
|
54 |
this.lastGcStartTime = lastGcStartTime; |
|
55 |
this.lastGcEndTime = lastGcEndTime; |
|
56 |
this.collectThreshold = collectThreshold; |
|
57 |
this.beforeGcUsage = beforeGcUsage; |
|
58 |
this.afterGcUsage = afterGcUsage; |
|
59 |
} |
|
60 |
||
61 |
/** |
|
62 |
* Returns the memory pool name. |
|
63 |
*/ |
|
64 |
public String getPoolName() { |
|
65 |
return poolName; |
|
66 |
} |
|
67 |
||
68 |
/** |
|
69 |
* Returns the current memory usage. |
|
70 |
*/ |
|
71 |
public MemoryUsage getUsage() { |
|
72 |
return usage; |
|
73 |
} |
|
74 |
||
75 |
/** |
|
76 |
* Returns the current usage threshold. |
|
77 |
* -1 if not supported. |
|
78 |
*/ |
|
79 |
public long getUsageThreshold() { |
|
80 |
return usageThreshold; |
|
81 |
} |
|
82 |
||
83 |
/** |
|
84 |
* Returns the current collection usage threshold. |
|
85 |
* -1 if not supported. |
|
86 |
*/ |
|
87 |
public long getCollectionUsageThreshold() { |
|
88 |
return collectThreshold; |
|
89 |
} |
|
90 |
||
91 |
/** |
|
92 |
* Returns the Id of GC. |
|
93 |
*/ |
|
94 |
public long getLastGcId() { |
|
95 |
return lastGcId; |
|
96 |
} |
|
97 |
||
98 |
||
99 |
/** |
|
100 |
* Returns the start time of the most recent GC on |
|
101 |
* the memory pool for this statistics in milliseconds. |
|
102 |
* |
|
103 |
* Return 0 if no GC occurs. |
|
104 |
*/ |
|
105 |
public long getLastGcStartTime() { |
|
106 |
return lastGcStartTime; |
|
107 |
} |
|
108 |
||
109 |
/** |
|
110 |
* Returns the end time of the most recent GC on |
|
111 |
* the memory pool for this statistics in milliseconds. |
|
112 |
* |
|
113 |
* Return 0 if no GC occurs. |
|
114 |
*/ |
|
115 |
public long getLastGcEndTime() { |
|
116 |
return lastGcEndTime; |
|
117 |
} |
|
118 |
||
119 |
/** |
|
120 |
* Returns the memory usage before the most recent GC started. |
|
121 |
* null if no GC occurs. |
|
122 |
*/ |
|
123 |
public MemoryUsage getBeforeGcUsage() { |
|
124 |
return beforeGcUsage; |
|
125 |
} |
|
126 |
||
127 |
/** |
|
128 |
* Returns the memory usage after the most recent GC finished. |
|
129 |
* null if no GC occurs. |
|
130 |
*/ |
|
131 |
public MemoryUsage getAfterGcUsage() { |
|
132 |
return beforeGcUsage; |
|
133 |
} |
|
134 |
} |