annotate agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1MonitoringSupport.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 81aa07130d30
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3984
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
1 /*
4830
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3984
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
4 *
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
7 * published by the Free Software Foundation.
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
8 *
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
13 * accompanied this code).
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
14 *
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
18 *
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
21 * questions.
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
22 *
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
23 */
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
24
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
25 package sun.jvm.hotspot.gc_implementation.g1;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
26
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
27 import java.util.Observable;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
28 import java.util.Observer;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
29
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
30 import sun.jvm.hotspot.debugger.Address;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
31 import sun.jvm.hotspot.runtime.VM;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
32 import sun.jvm.hotspot.runtime.VMObject;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
33 import sun.jvm.hotspot.types.CIntegerField;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
34 import sun.jvm.hotspot.types.Type;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
35 import sun.jvm.hotspot.types.TypeDataBase;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
36
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
37 // Mirror class for G1MonitoringSupport.
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
38
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
39 public class G1MonitoringSupport extends VMObject {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
40 // size_t _eden_committed;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
41 static private CIntegerField edenCommittedField;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
42 // size_t _eden_used;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
43 static private CIntegerField edenUsedField;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
44 // size_t _survivor_committed;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
45 static private CIntegerField survivorCommittedField;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
46 // size_t _survivor_used;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
47 static private CIntegerField survivorUsedField;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
48 // size_t _old_committed;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
49 static private CIntegerField oldCommittedField;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
50 // size_t _old_used;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
51 static private CIntegerField oldUsedField;
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
52
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
53 static {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
54 VM.registerVMInitializedObserver(new Observer() {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
55 public void update(Observable o, Object data) {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
56 initialize(VM.getVM().getTypeDataBase());
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
57 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
58 });
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
59 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
60
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
61 static private synchronized void initialize(TypeDataBase db) {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
62 Type type = db.lookupType("G1MonitoringSupport");
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
63
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
64 edenCommittedField = type.getCIntegerField("_eden_committed");
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
65 edenUsedField = type.getCIntegerField("_eden_used");
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
66 survivorCommittedField = type.getCIntegerField("_survivor_committed");
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
67 survivorUsedField = type.getCIntegerField("_survivor_used");
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
68 oldCommittedField = type.getCIntegerField("_old_committed");
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
69 oldUsedField = type.getCIntegerField("_old_used");
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
70 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
71
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
72 public long edenCommitted() {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
73 return edenCommittedField.getValue(addr);
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
74 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
75
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
76 public long edenUsed() {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
77 return edenUsedField.getValue(addr);
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
78 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
79
4830
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
80 public long edenRegionNum() {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
81 return edenUsed() / HeapRegion.grainBytes();
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
82 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
83
3984
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
84 public long survivorCommitted() {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
85 return survivorCommittedField.getValue(addr);
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
86 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
87
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
88 public long survivorUsed() {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
89 return survivorUsedField.getValue(addr);
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
90 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
91
4830
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
92 public long survivorRegionNum() {
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
93 return survivorUsed() / HeapRegion.grainBytes();
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
94 }
0b3d1ec6eaee 7097586: G1: improve the per-space output when using jmap -heap
tonyp
parents: 3984
diff changeset
95
3984
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
96 public long oldCommitted() {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
97 return oldCommittedField.getValue(addr);
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
98 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
99
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
100 public long oldUsed() {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
101 return oldUsedField.getValue(addr);
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
102 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
103
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
104 public G1MonitoringSupport(Address addr) {
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
105 super(addr);
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
106 }
81aa07130d30 7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
diff changeset
107 }