< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1MonitoringSupport.java

Print this page


   1 /*
   2  * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
   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  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.gc.g1;
  26 
  27 import java.util.Observable;
  28 import java.util.Observer;
  29 
  30 import sun.jvm.hotspot.debugger.Address;
  31 import sun.jvm.hotspot.runtime.VM;
  32 import sun.jvm.hotspot.runtime.VMObject;
  33 import sun.jvm.hotspot.types.CIntegerField;
  34 import sun.jvm.hotspot.types.Type;
  35 import sun.jvm.hotspot.types.TypeDataBase;
  36 
  37 // Mirror class for G1MonitoringSupport.
  38 
  39 public class G1MonitoringSupport extends VMObject {


  40     // size_t _eden_space_committed;
  41     static private CIntegerField edenSpaceCommittedField;
  42     // size_t _eden_space_used;
  43     static private CIntegerField edenSpaceUsedField;
  44     // size_t _survivor_space_committed;
  45     static private CIntegerField survivorSpaceCommittedField;
  46     // size_t _survivor_space_used;
  47     static private CIntegerField survivorSpaceUsedField;
  48     // size_t _old_gen_committed;
  49     static private CIntegerField oldGenCommittedField;
  50     // size_t _old_gen_used;
  51     static private CIntegerField oldGenUsedField;








  52 
  53     static {
  54         VM.registerVMInitializedObserver(new Observer() {
  55                 public void update(Observable o, Object data) {
  56                     initialize(VM.getVM().getTypeDataBase());
  57                 }
  58             });
  59     }
  60 
  61     static private synchronized void initialize(TypeDataBase db) {
  62         Type type = db.lookupType("G1MonitoringSupport");
  63 

  64         edenSpaceCommittedField = type.getCIntegerField("_eden_space_committed");
  65         edenSpaceUsedField = type.getCIntegerField("_eden_space_used");
  66         survivorSpaceCommittedField = type.getCIntegerField("_survivor_space_committed");
  67         survivorSpaceUsedField = type.getCIntegerField("_survivor_space_used");
  68         oldGenCommittedField = type.getCIntegerField("_old_gen_committed");
  69         oldGenUsedField = type.getCIntegerField("_old_gen_used");








  70     }
  71 
  72     public long edenSpaceCommitted() {
  73         return edenSpaceCommittedField.getValue(addr);
  74     }
  75 
  76     public long edenSpaceUsed() {
  77         return edenSpaceUsedField.getValue(addr);
  78     }
  79 
  80     public long edenSpaceRegionNum() {
  81         return edenSpaceUsed() / HeapRegion.grainBytes();
  82     }
  83 
  84     public long survivorSpaceCommitted() {
  85         return survivorSpaceCommittedField.getValue(addr);
  86     }
  87 
  88     public long survivorSpaceUsed() {
  89         return survivorSpaceUsedField.getValue(addr);
  90     }
  91 
  92     public long survivorSpaceRegionNum() {
  93         return survivorSpaceUsed() / HeapRegion.grainBytes();
  94     }
  95 
  96     public long oldGenCommitted() {
  97         return oldGenCommittedField.getValue(addr);




























  98     }
  99 
 100     public long oldGenUsed() {
 101         return oldGenUsedField.getValue(addr);
 102     }
 103 
 104     public G1MonitoringSupport(Address addr) {
 105         super(addr);
 106     }
 107 }
   1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   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  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.gc.g1;
  26 
  27 import java.util.Observable;
  28 import java.util.Observer;
  29 
  30 import sun.jvm.hotspot.debugger.Address;
  31 import sun.jvm.hotspot.runtime.VM;
  32 import sun.jvm.hotspot.runtime.VMObject;
  33 import sun.jvm.hotspot.types.CIntegerField;
  34 import sun.jvm.hotspot.types.Type;
  35 import sun.jvm.hotspot.types.TypeDataBase;
  36 
  37 // Mirror class for G1MonitoringSupport.
  38 
  39 public class G1MonitoringSupport extends VMObject {
  40     // bool _use_legacy_monitoring;
  41     static private CIntegerField useLegacyMonitoringField;
  42     // size_t _eden_space_committed;
  43     static private CIntegerField edenSpaceCommittedField;
  44     // size_t _eden_space_used;
  45     static private CIntegerField edenSpaceUsedField;
  46     // size_t _survivor_space_committed;
  47     static private CIntegerField survivorSpaceCommittedField;
  48     // size_t _survivor_space_used;
  49     static private CIntegerField survivorSpaceUsedField;
  50     // size_t _old_space_committed;
  51     static private CIntegerField oldSpaceCommittedField;
  52     // size_t _old_space_used;
  53     static private CIntegerField oldSpaceUsedField;
  54     // size_t _archive_space_committed;
  55     static private CIntegerField archiveSpaceCommittedField;
  56     // size_t _archive_space_used;
  57     static private CIntegerField archiveSpaceUsedField;
  58     // size_t _humongous_space_committed;
  59     static private CIntegerField humongousSpaceCommittedField;
  60     // size_t _humongous_space_used;
  61     static private CIntegerField humongousSpaceUsedField;
  62 
  63     static {
  64         VM.registerVMInitializedObserver(new Observer() {
  65                 public void update(Observable o, Object data) {
  66                     initialize(VM.getVM().getTypeDataBase());
  67                 }
  68             });
  69     }
  70 
  71     static private synchronized void initialize(TypeDataBase db) {
  72         Type type = db.lookupType("G1MonitoringSupport");
  73 
  74         useLegacyMonitoringField = type.getCIntegerField("_use_legacy_monitoring");
  75         edenSpaceCommittedField = type.getCIntegerField("_eden_space_committed");
  76         edenSpaceUsedField = type.getCIntegerField("_eden_space_used");
  77         survivorSpaceCommittedField = type.getCIntegerField("_survivor_space_committed");
  78         survivorSpaceUsedField = type.getCIntegerField("_survivor_space_used");
  79         oldSpaceCommittedField = type.getCIntegerField("_old_space_committed");
  80         oldSpaceUsedField = type.getCIntegerField("_old_space_used");
  81         archiveSpaceCommittedField = type.getCIntegerField("_archive_space_committed");
  82         archiveSpaceUsedField = type.getCIntegerField("_archive_space_used");
  83         humongousSpaceCommittedField = type.getCIntegerField("_humongous_space_committed");
  84         humongousSpaceUsedField = type.getCIntegerField("_humongous_space_used");
  85     }
  86 
  87     public boolean useLegacyMonitoring() {
  88         return useLegacyMonitoringField.getValue(addr) != 0;
  89     }
  90 
  91     public long edenSpaceCommitted() {
  92         return edenSpaceCommittedField.getValue(addr);
  93     }
  94 
  95     public long edenSpaceUsed() {
  96         return edenSpaceUsedField.getValue(addr);
  97     }
  98 
  99     public long edenSpaceRegionNum() {
 100         return edenSpaceUsed() / HeapRegion.grainBytes();
 101     }
 102 
 103     public long survivorSpaceCommitted() {
 104         return survivorSpaceCommittedField.getValue(addr);
 105     }
 106 
 107     public long survivorSpaceUsed() {
 108         return survivorSpaceUsedField.getValue(addr);
 109     }
 110 
 111     public long survivorSpaceRegionNum() {
 112         return survivorSpaceUsed() / HeapRegion.grainBytes();
 113     }
 114 
 115     public long oldSpaceCommitted() {
 116         return oldSpaceCommittedField.getValue(addr);
 117     }
 118 
 119     public long oldSpaceUsed() {
 120         return oldSpaceUsedField.getValue(addr);
 121     }
 122 
 123     public long oldSpaceRegionNum() {
 124         return oldSpaceUsed() / HeapRegion.grainBytes();
 125     }
 126 
 127     public long archiveSpaceCommitted() {
 128         return archiveSpaceCommittedField.getValue(addr);
 129     }
 130 
 131     public long archiveSpaceUsed() {
 132         return archiveSpaceUsedField.getValue(addr);
 133     }
 134 
 135     public long archiveSpaceRegionNum() {
 136         return archiveSpaceUsed() / HeapRegion.grainBytes();
 137     }
 138 
 139     public long humongousSpaceCommitted() {
 140         return humongousSpaceCommittedField.getValue(addr);
 141     }
 142 
 143     public long humongousSpaceUsed() {
 144         return humongousSpaceUsedField.getValue(addr);
 145     }
 146 
 147     public long humongousSpaceRegionNum() {
 148         return humongousSpaceUsed() / HeapRegion.grainBytes();
 149     }
 150 
 151     public G1MonitoringSupport(Address addr) {
 152         super(addr);
 153     }
 154 }
< prev index next >