Mercurial > hg > graal-jvmci-8
comparison agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java @ 4830:0b3d1ec6eaee
7097586: G1: improve the per-space output when using jmap -heap
Summary: Extend the jmap -heap output for G1 to include some more G1-specific information.
Reviewed-by: brutisso, johnc, poonam
author | tonyp |
---|---|
date | Wed, 18 Jan 2012 10:30:12 -0500 |
parents | e3e363b2bf19 |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
4829:9509c20bba28 | 4830:0b3d1ec6eaee |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
65 printValMB("OldSize = ", getFlagValue("OldSize", flagMap)); | 65 printValMB("OldSize = ", getFlagValue("OldSize", flagMap)); |
66 printValue("NewRatio = ", getFlagValue("NewRatio", flagMap)); | 66 printValue("NewRatio = ", getFlagValue("NewRatio", flagMap)); |
67 printValue("SurvivorRatio = ", getFlagValue("SurvivorRatio", flagMap)); | 67 printValue("SurvivorRatio = ", getFlagValue("SurvivorRatio", flagMap)); |
68 printValMB("PermSize = ", getFlagValue("PermSize", flagMap)); | 68 printValMB("PermSize = ", getFlagValue("PermSize", flagMap)); |
69 printValMB("MaxPermSize = ", getFlagValue("MaxPermSize", flagMap)); | 69 printValMB("MaxPermSize = ", getFlagValue("MaxPermSize", flagMap)); |
70 printValMB("G1HeapRegionSize = ", HeapRegion.grainBytes()); | |
70 | 71 |
71 System.out.println(); | 72 System.out.println(); |
72 System.out.println("Heap Usage:"); | 73 System.out.println("Heap Usage:"); |
73 | 74 |
74 if (heap instanceof SharedHeap) { | 75 if (heap instanceof SharedHeap) { |
98 } | 99 } |
99 } | 100 } |
100 } else if (sharedHeap instanceof G1CollectedHeap) { | 101 } else if (sharedHeap instanceof G1CollectedHeap) { |
101 G1CollectedHeap g1h = (G1CollectedHeap) sharedHeap; | 102 G1CollectedHeap g1h = (G1CollectedHeap) sharedHeap; |
102 G1MonitoringSupport g1mm = g1h.g1mm(); | 103 G1MonitoringSupport g1mm = g1h.g1mm(); |
103 System.out.println("G1 Young Generation"); | 104 long edenRegionNum = g1mm.edenRegionNum(); |
104 printG1Space("Eden Space:", g1mm.edenUsed(), g1mm.edenCommitted()); | 105 long survivorRegionNum = g1mm.survivorRegionNum(); |
105 printG1Space("From Space:", g1mm.survivorUsed(), g1mm.survivorCommitted()); | 106 HeapRegionSetBase oldSet = g1h.oldSet(); |
106 printG1Space("To Space:", 0, 0); | 107 HeapRegionSetBase humongousSet = g1h.humongousSet(); |
107 printG1Space("G1 Old Generation", g1mm.oldUsed(), g1mm.oldCommitted()); | 108 long oldRegionNum = oldSet.regionNum() + humongousSet.regionNum(); |
109 printG1Space("G1 Heap:", g1h.n_regions(), | |
110 g1h.used(), g1h.capacity()); | |
111 System.out.println("G1 Young Generation:"); | |
112 printG1Space("Eden Space:", edenRegionNum, | |
113 g1mm.edenUsed(), g1mm.edenCommitted()); | |
114 printG1Space("Survivor Space:", survivorRegionNum, | |
115 g1mm.survivorUsed(), g1mm.survivorCommitted()); | |
116 printG1Space("G1 Old Generation:", oldRegionNum, | |
117 g1mm.oldUsed(), g1mm.oldCommitted()); | |
108 } else { | 118 } else { |
109 throw new RuntimeException("unknown SharedHeap type : " + heap.getClass()); | 119 throw new RuntimeException("unknown SharedHeap type : " + heap.getClass()); |
110 } | 120 } |
111 // Perm generation shared by the above | 121 // Perm generation shared by the above |
112 Generation permGen = sharedHeap.permGen(); | 122 Generation permGen = sharedHeap.permGen(); |
214 printValMB("used = ", space.used()); | 224 printValMB("used = ", space.used()); |
215 printValMB("free = ", space.free()); | 225 printValMB("free = ", space.free()); |
216 System.out.println(alignment + (double)space.used() * 100.0 / space.capacity() + "% used"); | 226 System.out.println(alignment + (double)space.used() * 100.0 / space.capacity() + "% used"); |
217 } | 227 } |
218 | 228 |
219 private void printG1Space(String spaceName, long used, long capacity) { | 229 private void printG1Space(String spaceName, long regionNum, |
230 long used, long capacity) { | |
220 long free = capacity - used; | 231 long free = capacity - used; |
221 System.out.println(spaceName); | 232 System.out.println(spaceName); |
233 printValue("regions = ", regionNum); | |
222 printValMB("capacity = ", capacity); | 234 printValMB("capacity = ", capacity); |
223 printValMB("used = ", used); | 235 printValMB("used = ", used); |
224 printValMB("free = ", free); | 236 printValMB("free = ", free); |
225 double occPerc = (capacity > 0) ? (double) used * 100.0 / capacity : 0.0; | 237 double occPerc = (capacity > 0) ? (double) used * 100.0 / capacity : 0.0; |
226 System.out.println(alignment + occPerc + "% used"); | 238 System.out.println(alignment + occPerc + "% used"); |