Mercurial > hg > truffle
annotate agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java @ 13705:ac5b0f31f7a2
Truffle API-change: FrameDescriptors are now stored in the RootNode in a final field instead of the CallTarget.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Fri, 17 Jan 2014 17:06:08 +0100 |
parents | 7fe6ef09d242 |
children | de6a9e811145 |
rev | line source |
---|---|
0 | 1 /* |
4830
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
337
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
337
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
337
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.tools; | |
26 | |
27 import java.util.*; | |
28 import sun.jvm.hotspot.gc_interface.*; | |
3972 | 29 import sun.jvm.hotspot.gc_implementation.g1.*; |
0 | 30 import sun.jvm.hotspot.gc_implementation.parallelScavenge.*; |
31 import sun.jvm.hotspot.gc_implementation.shared.*; | |
11054
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
32 import sun.jvm.hotspot.debugger.JVMDebugger; |
0 | 33 import sun.jvm.hotspot.memory.*; |
4061
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
34 import sun.jvm.hotspot.oops.*; |
0 | 35 import sun.jvm.hotspot.runtime.*; |
36 | |
37 public class HeapSummary extends Tool { | |
38 | |
11054
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
39 public HeapSummary() { |
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
40 super(); |
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
41 } |
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
42 |
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
43 public HeapSummary(JVMDebugger d) { |
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
44 super(d); |
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
45 } |
38ea2efa32a7
8010278: SA: provide mechanism for using an alternative SA debugger back-end.
kevinw
parents:
8114
diff
changeset
|
46 |
0 | 47 public static void main(String[] args) { |
48 HeapSummary hs = new HeapSummary(); | |
12932
7fe6ef09d242
8025638: jmap returns 0 instead of 1 when it fails.
farvidsson
parents:
12226
diff
changeset
|
49 hs.execute(args); |
0 | 50 } |
51 | |
52 public void run() { | |
53 CollectedHeap heap = VM.getVM().getUniverse().heap(); | |
54 VM.Flag[] flags = VM.getVM().getCommandLineFlags(); | |
55 Map flagMap = new HashMap(); | |
56 if (flags == null) { | |
57 System.out.println("WARNING: command line flags are not available"); | |
58 } else { | |
59 for (int f = 0; f < flags.length; f++) { | |
60 flagMap.put(flags[f].getName(), flags[f]); | |
61 } | |
62 } | |
63 | |
64 System.out.println(); | |
65 printGCAlgorithm(flagMap); | |
66 System.out.println(); | |
67 System.out.println("Heap Configuration:"); | |
12226
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
68 printValue("MinHeapFreeRatio = ", getFlagValue("MinHeapFreeRatio", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
69 printValue("MaxHeapFreeRatio = ", getFlagValue("MaxHeapFreeRatio", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
70 printValMB("MaxHeapSize = ", getFlagValue("MaxHeapSize", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
71 printValMB("NewSize = ", getFlagValue("NewSize", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
72 printValMB("MaxNewSize = ", getFlagValue("MaxNewSize", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
73 printValMB("OldSize = ", getFlagValue("OldSize", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
74 printValue("NewRatio = ", getFlagValue("NewRatio", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
75 printValue("SurvivorRatio = ", getFlagValue("SurvivorRatio", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
76 printValMB("MetaspaceSize = ", getFlagValue("MetaspaceSize", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
77 printValMB("CompressedClassSpaceSize = ", getFlagValue("CompressedClassSpaceSize", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
78 printValMB("MaxMetaspaceSize = ", getFlagValue("MaxMetaspaceSize", flagMap)); |
7944aba7ba41
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
11054
diff
changeset
|
79 printValMB("G1HeapRegionSize = ", HeapRegion.grainBytes()); |
0 | 80 |
81 System.out.println(); | |
82 System.out.println("Heap Usage:"); | |
83 | |
3972 | 84 if (heap instanceof SharedHeap) { |
85 SharedHeap sharedHeap = (SharedHeap) heap; | |
86 if (sharedHeap instanceof GenCollectedHeap) { | |
87 GenCollectedHeap genHeap = (GenCollectedHeap) sharedHeap; | |
88 for (int n = 0; n < genHeap.nGens(); n++) { | |
89 Generation gen = genHeap.getGen(n); | |
90 if (gen instanceof sun.jvm.hotspot.memory.DefNewGeneration) { | |
91 System.out.println("New Generation (Eden + 1 Survivor Space):"); | |
92 printGen(gen); | |
0 | 93 |
3972 | 94 ContiguousSpace eden = ((DefNewGeneration)gen).eden(); |
95 System.out.println("Eden Space:"); | |
96 printSpace(eden); | |
97 | |
98 ContiguousSpace from = ((DefNewGeneration)gen).from(); | |
99 System.out.println("From Space:"); | |
100 printSpace(from); | |
0 | 101 |
3972 | 102 ContiguousSpace to = ((DefNewGeneration)gen).to(); |
103 System.out.println("To Space:"); | |
104 printSpace(to); | |
105 } else { | |
106 System.out.println(gen.name() + ":"); | |
107 printGen(gen); | |
108 } | |
109 } | |
110 } else if (sharedHeap instanceof G1CollectedHeap) { | |
111 G1CollectedHeap g1h = (G1CollectedHeap) sharedHeap; | |
3984
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
112 G1MonitoringSupport g1mm = g1h.g1mm(); |
4830
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
113 long edenRegionNum = g1mm.edenRegionNum(); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
114 long survivorRegionNum = g1mm.survivorRegionNum(); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
115 HeapRegionSetBase oldSet = g1h.oldSet(); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
116 HeapRegionSetBase humongousSet = g1h.humongousSet(); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
117 long oldRegionNum = oldSet.regionNum() + humongousSet.regionNum(); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
118 printG1Space("G1 Heap:", g1h.n_regions(), |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
119 g1h.used(), g1h.capacity()); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
120 System.out.println("G1 Young Generation:"); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
121 printG1Space("Eden Space:", edenRegionNum, |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
122 g1mm.edenUsed(), g1mm.edenCommitted()); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
123 printG1Space("Survivor Space:", survivorRegionNum, |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
124 g1mm.survivorUsed(), g1mm.survivorCommitted()); |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
125 printG1Space("G1 Old Generation:", oldRegionNum, |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
126 g1mm.oldUsed(), g1mm.oldCommitted()); |
3972 | 127 } else { |
128 throw new RuntimeException("unknown SharedHeap type : " + heap.getClass()); | |
0 | 129 } |
130 } else if (heap instanceof ParallelScavengeHeap) { | |
131 ParallelScavengeHeap psh = (ParallelScavengeHeap) heap; | |
132 PSYoungGen youngGen = psh.youngGen(); | |
133 printPSYoungGen(youngGen); | |
134 | |
135 PSOldGen oldGen = psh.oldGen(); | |
136 long oldFree = oldGen.capacity() - oldGen.used(); | |
137 System.out.println("PS Old Generation"); | |
138 printValMB("capacity = ", oldGen.capacity()); | |
139 printValMB("used = ", oldGen.used()); | |
140 printValMB("free = ", oldFree); | |
141 System.out.println(alignment + (double)oldGen.used() * 100.0 / oldGen.capacity() + "% used"); | |
142 } else { | |
3972 | 143 throw new RuntimeException("unknown CollectedHeap type : " + heap.getClass()); |
0 | 144 } |
4061
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
145 |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
146 System.out.println(); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
147 printInternStringStatistics(); |
0 | 148 } |
149 | |
150 // Helper methods | |
151 | |
152 private void printGCAlgorithm(Map flagMap) { | |
153 // print about new generation | |
154 long l = getFlagValue("UseParNewGC", flagMap); | |
155 if (l == 1L) { | |
156 System.out.println("using parallel threads in the new generation."); | |
157 } | |
158 | |
159 l = getFlagValue("UseTLAB", flagMap); | |
160 if (l == 1L) { | |
161 System.out.println("using thread-local object allocation."); | |
162 } | |
163 | |
164 l = getFlagValue("UseConcMarkSweepGC", flagMap); | |
165 if (l == 1L) { | |
166 System.out.println("Concurrent Mark-Sweep GC"); | |
167 return; | |
168 } | |
169 | |
170 l = getFlagValue("UseParallelGC", flagMap); | |
171 if (l == 1L) { | |
172 System.out.print("Parallel GC "); | |
173 l = getFlagValue("ParallelGCThreads", flagMap); | |
174 System.out.println("with " + l + " thread(s)"); | |
175 return; | |
176 } | |
177 | |
3972 | 178 l = getFlagValue("UseG1GC", flagMap); |
179 if (l == 1L) { | |
180 System.out.print("Garbage-First (G1) GC "); | |
181 l = getFlagValue("ParallelGCThreads", flagMap); | |
182 System.out.println("with " + l + " thread(s)"); | |
183 return; | |
184 } | |
185 | |
0 | 186 System.out.println("Mark Sweep Compact GC"); |
187 } | |
188 | |
189 private void printPSYoungGen(PSYoungGen youngGen) { | |
190 System.out.println("PS Young Generation"); | |
191 MutableSpace eden = youngGen.edenSpace(); | |
192 System.out.println("Eden Space:"); | |
193 printMutableSpace(eden); | |
194 MutableSpace from = youngGen.fromSpace(); | |
195 System.out.println("From Space:"); | |
196 printMutableSpace(from); | |
197 MutableSpace to = youngGen.toSpace(); | |
198 System.out.println("To Space:"); | |
199 printMutableSpace(to); | |
200 } | |
201 | |
202 private void printMutableSpace(MutableSpace space) { | |
203 printValMB("capacity = ", space.capacity()); | |
204 printValMB("used = ", space.used()); | |
205 long free = space.capacity() - space.used(); | |
206 printValMB("free = ", free); | |
207 System.out.println(alignment + (double)space.used() * 100.0 / space.capacity() + "% used"); | |
208 } | |
209 | |
210 private static String alignment = " "; | |
211 | |
212 private void printGen(Generation gen) { | |
213 printValMB("capacity = ", gen.capacity()); | |
214 printValMB("used = ", gen.used()); | |
215 printValMB("free = ", gen.free()); | |
216 System.out.println(alignment + (double)gen.used() * 100.0 / gen.capacity() + "% used"); | |
217 } | |
218 | |
219 private void printSpace(ContiguousSpace space) { | |
220 printValMB("capacity = ", space.capacity()); | |
221 printValMB("used = ", space.used()); | |
222 printValMB("free = ", space.free()); | |
223 System.out.println(alignment + (double)space.used() * 100.0 / space.capacity() + "% used"); | |
224 } | |
225 | |
4830
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
226 private void printG1Space(String spaceName, long regionNum, |
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
227 long used, long capacity) { |
3984
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
228 long free = capacity - used; |
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
229 System.out.println(spaceName); |
4830
0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents:
4061
diff
changeset
|
230 printValue("regions = ", regionNum); |
3984
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
231 printValMB("capacity = ", capacity); |
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
232 printValMB("used = ", used); |
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
233 printValMB("free = ", free); |
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
234 double occPerc = (capacity > 0) ? (double) used * 100.0 / capacity : 0.0; |
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
235 System.out.println(alignment + occPerc + "% used"); |
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
236 } |
81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
3972
diff
changeset
|
237 |
0 | 238 private static final double FACTOR = 1024*1024; |
239 private void printValMB(String title, long value) { | |
281
a2de7dfbfcf0
6718125: SA: jmap prints negative size for MaxNewHeap.
swamyv
parents:
0
diff
changeset
|
240 if (value < 0) { |
a2de7dfbfcf0
6718125: SA: jmap prints negative size for MaxNewHeap.
swamyv
parents:
0
diff
changeset
|
241 System.out.println(alignment + title + (value >>> 20) + " MB"); |
a2de7dfbfcf0
6718125: SA: jmap prints negative size for MaxNewHeap.
swamyv
parents:
0
diff
changeset
|
242 } else { |
a2de7dfbfcf0
6718125: SA: jmap prints negative size for MaxNewHeap.
swamyv
parents:
0
diff
changeset
|
243 double mb = value/FACTOR; |
a2de7dfbfcf0
6718125: SA: jmap prints negative size for MaxNewHeap.
swamyv
parents:
0
diff
changeset
|
244 System.out.println(alignment + title + value + " (" + mb + "MB)"); |
a2de7dfbfcf0
6718125: SA: jmap prints negative size for MaxNewHeap.
swamyv
parents:
0
diff
changeset
|
245 } |
0 | 246 } |
247 | |
248 private void printValue(String title, long value) { | |
249 System.out.println(alignment + title + value); | |
250 } | |
251 | |
252 private long getFlagValue(String name, Map flagMap) { | |
253 VM.Flag f = (VM.Flag) flagMap.get(name); | |
254 if (f != null) { | |
255 if (f.isBool()) { | |
256 return f.getBool()? 1L : 0L; | |
257 } else { | |
258 return Long.parseLong(f.getValue()); | |
259 } | |
260 } else { | |
261 return -1; | |
262 } | |
263 } | |
4061
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
264 |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
265 private void printInternStringStatistics() { |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
266 class StringStat implements StringTable.StringVisitor { |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
267 private int count; |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
268 private long size; |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
269 private OopField stringValueField; |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
270 |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
271 StringStat() { |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
272 VM vm = VM.getVM(); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
273 SystemDictionary sysDict = vm.getSystemDictionary(); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
274 InstanceKlass strKlass = sysDict.getStringKlass(); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
275 // String has a field named 'value' of type 'char[]'. |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
276 stringValueField = (OopField) strKlass.findField("value", "[C"); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
277 } |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
278 |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
279 private long stringSize(Instance instance) { |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
280 // We include String content in size calculation. |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
281 return instance.getObjectSize() + |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
282 stringValueField.getValue(instance).getObjectSize(); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
283 } |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
284 |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
285 public void visit(Instance str) { |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
286 count++; |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
287 size += stringSize(str); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
288 } |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
289 |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
290 public void print() { |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
291 System.out.println(count + |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
292 " interned Strings occupying " + size + " bytes."); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
293 } |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
294 } |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
295 |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
296 StringStat stat = new StringStat(); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
297 StringTable strTable = VM.getVM().getStringTable(); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
298 strTable.stringsDo(stat); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
299 stat.print(); |
e3e363b2bf19
7108242: jinfo -permstat shouldn't report interned strings as part of perm
never
parents:
3984
diff
changeset
|
300 } |
0 | 301 } |