diff agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.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 0b3d1ec6eaee
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java	Mon Oct 03 12:49:53 2011 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java	Mon Oct 03 19:04:14 2011 -0400
@@ -35,6 +35,7 @@
 import sun.jvm.hotspot.memory.SpaceClosure;
 import sun.jvm.hotspot.runtime.VM;
 import sun.jvm.hotspot.runtime.VMObjectFactory;
+import sun.jvm.hotspot.types.AddressField;
 import sun.jvm.hotspot.types.CIntegerField;
 import sun.jvm.hotspot.types.Type;
 import sun.jvm.hotspot.types.TypeDataBase;
@@ -48,6 +49,8 @@
     static private long g1CommittedFieldOffset;
     // size_t _summary_bytes_used;
     static private CIntegerField summaryBytesUsedField;
+    // G1MonitoringSupport* _g1mm
+    static private AddressField g1mmField;
 
     static {
         VM.registerVMInitializedObserver(new Observer() {
@@ -63,6 +66,7 @@
         hrsFieldOffset = type.getField("_hrs").getOffset();
         g1CommittedFieldOffset = type.getField("_g1_committed").getOffset();
         summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used");
+        g1mmField = type.getAddressField("_g1mm");
     }
 
     public long capacity() {
@@ -85,6 +89,11 @@
                                                          hrsAddr);
     }
 
+    public G1MonitoringSupport g1mm() {
+        Address g1mmAddr = g1mmField.getValue(addr);
+        return (G1MonitoringSupport) VMObjectFactory.newObject(G1MonitoringSupport.class, g1mmAddr);
+    }
+
     private Iterator<HeapRegion> heapRegionIterator() {
         return hrs().heapRegionIterator();
     }