annotate src/share/vm/services/g1MemoryPool.hpp @ 3289:b52782ae3880

6946417: G1: Java VisualVM does not support G1 properly. Summary: Added counters for jstat Reviewed-by: tonyp, jwilhelm, stefank, ysr, johnc
author jmasa
date Thu, 21 Apr 2011 10:23:44 -0700
parents f95d63e2154a
children 8229bd737950
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
1 /*
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents: 1972
diff changeset
2 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
4 *
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
7 * published by the Free Software Foundation.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
8 *
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
13 * accompanied this code).
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
14 *
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1093
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1093
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1093
diff changeset
21 * questions.
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
22 *
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
23 */
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
25 #ifndef SHARE_VM_SERVICES_G1MEMORYPOOL_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
26 #define SHARE_VM_SERVICES_G1MEMORYPOOL_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
28 #ifndef SERIALGC
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
29 #include "services/memoryPool.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
30 #include "services/memoryUsage.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
31 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
32
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
33 class G1CollectedHeap;
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
34
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
35 // This file contains the three classes that represent the memory
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
36 // pools of the G1 spaces: G1EdenPool, G1SurvivorPool, and
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
37 // G1OldGenPool. In G1, unlike our other GCs, we do not have a
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
38 // physical space for each of those spaces. Instead, we allocate
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
39 // regions for all three spaces out of a single pool of regions (that
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
40 // pool basically covers the entire heap). As a result, the eden,
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
41 // survivor, and old gen are considered logical spaces in G1, as each
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
42 // is a set of non-contiguous regions. This is also reflected in the
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
43 // way we map them to memory pools here. The easiest way to have done
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
44 // this would have been to map the entire G1 heap to a single memory
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
45 // pool. However, it's helpful to show how large the eden and survivor
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
46 // get, as this does affect the performance and behavior of G1. Which
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
47 // is why we introduce the three memory pools implemented here.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
48 //
3289
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents: 1972
diff changeset
49 // See comments in g1MonitoringSupport.hpp for additional details
b52782ae3880 6946417: G1: Java VisualVM does not support G1 properly.
jmasa
parents: 1972
diff changeset
50 // on this model.
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
51 //
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
52
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
53
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
54 // This class is shared by the three G1 memory pool classes
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
55 // (G1EdenPool, G1SurvivorPool, G1OldGenPool). Given that the way we
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
56 // calculate used / committed bytes for these three pools is related
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
57 // (see comment above), we put the calculations in this class so that
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
58 // we can easily share them among the subclasses.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
59 class G1MemoryPoolSuper : public CollectedMemoryPool {
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
60 protected:
1093
afc30fccf324 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 1092
diff changeset
61 G1CollectedHeap* _g1h;
afc30fccf324 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 1092
diff changeset
62
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
63 // Would only be called from subclasses.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
64 G1MemoryPoolSuper(G1CollectedHeap* g1h,
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
65 const char* name,
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
66 size_t init_size,
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
67 bool support_usage_threshold);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
68
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
69 // The reason why all the code is in static methods is so that it
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
70 // can be safely called from the constructors of the subclasses.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
71
1754
e967bad2a9ab 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 1552
diff changeset
72 static size_t undefined_max() {
e967bad2a9ab 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 1552
diff changeset
73 return (size_t) -1;
e967bad2a9ab 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 1552
diff changeset
74 }
e967bad2a9ab 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 1552
diff changeset
75
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
76 static size_t eden_space_committed(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
77 static size_t eden_space_used(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
78
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
79 static size_t survivor_space_committed(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
80 static size_t survivor_space_used(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
81
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
82 static size_t old_space_committed(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
83 static size_t old_space_used(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
84 };
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
85
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
86 // Memory pool that represents the G1 eden.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
87 class G1EdenPool : public G1MemoryPoolSuper {
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
88 public:
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
89 G1EdenPool(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
90
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
91 size_t used_in_bytes() {
1093
afc30fccf324 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 1092
diff changeset
92 return eden_space_used(_g1h);
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
93 }
1093
afc30fccf324 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 1092
diff changeset
94 size_t max_size() const {
1754
e967bad2a9ab 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 1552
diff changeset
95 return undefined_max();
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
96 }
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
97 MemoryUsage get_memory_usage();
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
98 };
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
99
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
100 // Memory pool that represents the G1 survivor.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
101 class G1SurvivorPool : public G1MemoryPoolSuper {
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
102 public:
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
103 G1SurvivorPool(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
104
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
105 size_t used_in_bytes() {
1093
afc30fccf324 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 1092
diff changeset
106 return survivor_space_used(_g1h);
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
107 }
1093
afc30fccf324 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 1092
diff changeset
108 size_t max_size() const {
1754
e967bad2a9ab 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 1552
diff changeset
109 return undefined_max();
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
110 }
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
111 MemoryUsage get_memory_usage();
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
112 };
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
113
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
114 // Memory pool that represents the G1 old gen.
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
115 class G1OldGenPool : public G1MemoryPoolSuper {
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
116 public:
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
117 G1OldGenPool(G1CollectedHeap* g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
118
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
119 size_t used_in_bytes() {
1093
afc30fccf324 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 1092
diff changeset
120 return old_space_used(_g1h);
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
121 }
1093
afc30fccf324 6906565: G1: deal with compilation warning in g1MemoryPool.hpp
tonyp
parents: 1092
diff changeset
122 size_t max_size() const {
1754
e967bad2a9ab 6941275: G1: The MemoryPools are incorrectly supported for G1
tonyp
parents: 1552
diff changeset
123 return undefined_max();
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
124 }
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
125 MemoryUsage get_memory_usage();
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
diff changeset
126 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
127
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1754
diff changeset
128 #endif // SHARE_VM_SERVICES_G1MEMORYPOOL_HPP