aboutsummaryrefslogtreecommitdiff
path: root/agent
diff options
context:
space:
mode:
authorkvn <none@none>2014-03-25 17:07:36 -0700
committerkvn <none@none>2014-03-25 17:07:36 -0700
commitc526e1df76a824196d04ec6caebc1862cc24e2d7 (patch)
tree8ed6a072f1ba8c4e4f19c237dc0700e95900bb92 /agent
parent4ed151910f1ca54b0c479ddaa61018da474d2ac9 (diff)
parent2fc1ec414432e6ecc4536cb2880d1c5a6bf0d9eb (diff)
downloadjdk8u_hotspot-c526e1df76a824196d04ec6caebc1862cc24e2d7.tar.gz
Merge
Diffstat (limited to 'agent')
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java4
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java24
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetCount.java73
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java3
4 files changed, 83 insertions, 21 deletions
diff --git a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java
index b75669ed0..eea5e4b72 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java
@@ -51,9 +51,9 @@ public class G1CollectedHeap extends SharedHeap {
static private CIntegerField summaryBytesUsedField;
// G1MonitoringSupport* _g1mm;
static private AddressField g1mmField;
- // MasterOldRegionSet _old_set;
+ // HeapRegionSet _old_set;
static private long oldSetFieldOffset;
- // MasterHumongousRegionSet _humongous_set;
+ // HeapRegionSet _humongous_set;
static private long humongousSetFieldOffset;
static {
diff --git a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java
index 4ac8f72c2..94c3e2399 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetBase.java
@@ -40,12 +40,8 @@ import sun.jvm.hotspot.types.TypeDataBase;
// Mirror class for HeapRegionSetBase. Represents a group of regions.
public class HeapRegionSetBase extends VMObject {
- // uint _length;
- static private CIntegerField lengthField;
- // uint _region_num;
- static private CIntegerField regionNumField;
- // size_t _total_used_bytes;
- static private CIntegerField totalUsedBytesField;
+
+ static private long countField;
static {
VM.registerVMInitializedObserver(new Observer() {
@@ -58,21 +54,13 @@ public class HeapRegionSetBase extends VMObject {
static private synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("HeapRegionSetBase");
- lengthField = type.getCIntegerField("_length");
- regionNumField = type.getCIntegerField("_region_num");
- totalUsedBytesField = type.getCIntegerField("_total_used_bytes");
- }
-
- public long length() {
- return lengthField.getValue(addr);
+ countField = type.getField("_count").getOffset();
}
- public long regionNum() {
- return regionNumField.getValue(addr);
- }
- public long totalUsedBytes() {
- return totalUsedBytesField.getValue(addr);
+ public HeapRegionSetCount count() {
+ Address countFieldAddr = addr.addOffsetTo(countField);
+ return (HeapRegionSetCount) VMObjectFactory.newObject(HeapRegionSetCount.class, countFieldAddr);
}
public HeapRegionSetBase(Address addr) {
diff --git a/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetCount.java b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetCount.java
new file mode 100644
index 000000000..2a4483a54
--- /dev/null
+++ b/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSetCount.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc_implementation.g1;
+
+import java.util.Iterator;
+import java.util.Observable;
+import java.util.Observer;
+
+import sun.jvm.hotspot.debugger.Address;
+import sun.jvm.hotspot.runtime.VM;
+import sun.jvm.hotspot.runtime.VMObject;
+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;
+
+// Mirror class for HeapRegionSetCount. Represents a group of regions.
+
+public class HeapRegionSetCount extends VMObject {
+
+ static private CIntegerField lengthField;
+ static private CIntegerField capacityField;
+
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ static private synchronized void initialize(TypeDataBase db) {
+ Type type = db.lookupType("HeapRegionSetCount");
+
+ lengthField = type.getCIntegerField("_length");
+ capacityField = type.getCIntegerField("_capacity");
+ }
+
+ public long length() {
+ return lengthField.getValue(addr);
+ }
+
+ public long capacity() {
+ return capacityField.getValue(addr);
+ }
+
+ public HeapRegionSetCount(Address addr) {
+ super(addr);
+ }
+}
diff --git a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
index 32c1358cb..afe4d2a50 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java
@@ -114,7 +114,8 @@ public class HeapSummary extends Tool {
long survivorRegionNum = g1mm.survivorRegionNum();
HeapRegionSetBase oldSet = g1h.oldSet();
HeapRegionSetBase humongousSet = g1h.humongousSet();
- long oldRegionNum = oldSet.regionNum() + humongousSet.regionNum();
+ long oldRegionNum = oldSet.count().length()
+ + humongousSet.count().capacity() / HeapRegion.grainBytes();
printG1Space("G1 Heap:", g1h.n_regions(),
g1h.used(), g1h.capacity());
System.out.println("G1 Young Generation:");