Mercurial > hg > graal-jvmci-8
comparison agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java @ 3984:81aa07130d30
7097048: G1: extend the G1 SA changes to print per-heap space information
Reviewed-by: brutisso, johnc
author | tonyp |
---|---|
date | Mon, 03 Oct 2011 19:04:14 -0400 |
parents | 4f93f0d00802 |
children | e3e363b2bf19 |
comparison
equal
deleted
inserted
replaced
3983:811ec3d0833b | 3984:81aa07130d30 |
---|---|
96 printGen(gen); | 96 printGen(gen); |
97 } | 97 } |
98 } | 98 } |
99 } else if (sharedHeap instanceof G1CollectedHeap) { | 99 } else if (sharedHeap instanceof G1CollectedHeap) { |
100 G1CollectedHeap g1h = (G1CollectedHeap) sharedHeap; | 100 G1CollectedHeap g1h = (G1CollectedHeap) sharedHeap; |
101 | 101 G1MonitoringSupport g1mm = g1h.g1mm(); |
102 System.out.println("Garbage-First (G1) Heap"); | 102 System.out.println("G1 Young Generation"); |
103 long capacityBytes = g1h.capacity(); | 103 printG1Space("Eden Space:", g1mm.edenUsed(), g1mm.edenCommitted()); |
104 long usedBytes = g1h.used(); | 104 printG1Space("From Space:", g1mm.survivorUsed(), g1mm.survivorCommitted()); |
105 long freeBytes = capacityBytes - usedBytes; | 105 printG1Space("To Space:", 0, 0); |
106 printValMB("region size = ", HeapRegion.grainBytes()); | 106 printG1Space("G1 Old Generation", g1mm.oldUsed(), g1mm.oldCommitted()); |
107 printValue("regions = ", g1h.n_regions()); | |
108 printValMB("capacity = ", capacityBytes); | |
109 printValMB("used = ", usedBytes); | |
110 printValMB("free = ", freeBytes); | |
111 System.out.println(alignment + (double) usedBytes * 100.0 / capacityBytes + "% used"); | |
112 } else { | 107 } else { |
113 throw new RuntimeException("unknown SharedHeap type : " + heap.getClass()); | 108 throw new RuntimeException("unknown SharedHeap type : " + heap.getClass()); |
114 } | 109 } |
115 // Perm generation shared by the above | 110 // Perm generation shared by the above |
116 Generation permGen = sharedHeap.permGen(); | 111 Generation permGen = sharedHeap.permGen(); |
215 printValMB("used = ", space.used()); | 210 printValMB("used = ", space.used()); |
216 printValMB("free = ", space.free()); | 211 printValMB("free = ", space.free()); |
217 System.out.println(alignment + (double)space.used() * 100.0 / space.capacity() + "% used"); | 212 System.out.println(alignment + (double)space.used() * 100.0 / space.capacity() + "% used"); |
218 } | 213 } |
219 | 214 |
215 private void printG1Space(String spaceName, long used, long capacity) { | |
216 long free = capacity - used; | |
217 System.out.println(spaceName); | |
218 printValMB("capacity = ", capacity); | |
219 printValMB("used = ", used); | |
220 printValMB("free = ", free); | |
221 double occPerc = (capacity > 0) ? (double) used * 100.0 / capacity : 0.0; | |
222 System.out.println(alignment + occPerc + "% used"); | |
223 } | |
224 | |
220 private static final double FACTOR = 1024*1024; | 225 private static final double FACTOR = 1024*1024; |
221 private void printValMB(String title, long value) { | 226 private void printValMB(String title, long value) { |
222 if (value < 0) { | 227 if (value < 0) { |
223 System.out.println(alignment + title + (value >>> 20) + " MB"); | 228 System.out.println(alignment + title + (value >>> 20) + " MB"); |
224 } else { | 229 } else { |