author | mgronlun |
Wed, 30 Oct 2019 19:43:52 +0100 | |
changeset 58863 | c16ac7a2eba4 |
parent 54467 | 0c5d713cf43f |
permissions | -rw-r--r-- |
9338 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51625
diff
changeset
|
2 |
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. |
9338 | 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 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51625
diff
changeset
|
25 |
#ifndef SHARE_GC_G1_G1MONITORINGSUPPORT_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51625
diff
changeset
|
26 |
#define SHARE_GC_G1_G1MONITORINGSUPPORT_HPP |
9338 | 27 |
|
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
28 |
#include "gc/shared/collectorCounters.hpp" |
48116 | 29 |
#include "gc/shared/generationCounters.hpp" |
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
30 |
#include "services/memoryManager.hpp" |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
31 |
#include "services/memoryService.hpp" |
51625
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
32 |
#include "runtime/mutex.hpp" |
9338 | 33 |
|
48116 | 34 |
class CollectorCounters; |
9338 | 35 |
class G1CollectedHeap; |
48116 | 36 |
class HSpaceCounters; |
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
37 |
class MemoryPool; |
9338 | 38 |
|
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
39 |
// Class for monitoring logical spaces in G1. It provides data for |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
40 |
// both G1's jstat counters as well as G1's memory pools. |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
41 |
// |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
42 |
// G1 splits the heap into heap regions and each heap region belongs |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
43 |
// to one of the following categories: |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
44 |
// |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
45 |
// * eden : regions that have been allocated since the last GC |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
46 |
// * survivors : regions with objects that survived the last few GCs |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
47 |
// * old : long-lived non-humongous regions |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
48 |
// * humongous : humongous regions |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
49 |
// * free : free regions |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
50 |
// |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
51 |
// The combination of eden and survivor regions form the equivalent of |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
52 |
// the young generation in the other GCs. The combination of old and |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
53 |
// humongous regions form the equivalent of the old generation in the |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
54 |
// other GCs. Free regions do not have a good equivalent in the other |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
55 |
// GCs given that they can be allocated as any of the other region types. |
9338 | 56 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
57 |
// The monitoring tools expect the heap to contain a number of |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
58 |
// generations (young, old, perm) and each generation to contain a |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
59 |
// number of spaces (young: eden, survivors, old). Given that G1 does |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
60 |
// not maintain those spaces physically (e.g., the set of |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
61 |
// non-contiguous eden regions can be considered as a "logical" |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
62 |
// space), we'll provide the illusion that those generations and |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
63 |
// spaces exist. In reality, each generation and space refers to a set |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
64 |
// of heap regions that are potentially non-contiguous. |
9338 | 65 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
66 |
// This class provides interfaces to access the min, current, and max |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
67 |
// capacity and current occupancy for each of G1's logical spaces and |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
68 |
// generations we expose to the monitoring tools. Also provided are |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
69 |
// counters for G1 concurrent collections and stop-the-world full heap |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
70 |
// collections. |
9338 | 71 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
72 |
// Below is a description of how the various sizes are calculated. |
9338 | 73 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
74 |
// * Current Capacity |
9338 | 75 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
76 |
// - heap_capacity = current heap capacity (e.g., current committed size) |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
77 |
// - young_gen_capacity = current max young gen target capacity |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
78 |
// (i.e., young gen target capacity + max allowed expansion capacity) |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
79 |
// - survivor_capacity = current survivor region capacity |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
80 |
// - eden_capacity = young_gen_capacity - survivor_capacity |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
81 |
// - old_capacity = heap_capacity - young_gen_capacity |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
82 |
// |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
83 |
// What we do in the above is to distribute the free regions among |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
84 |
// eden_capacity and old_capacity. |
9338 | 85 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
86 |
// * Occupancy |
9338 | 87 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
88 |
// - young_gen_used = current young region capacity |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
89 |
// - survivor_used = survivor_capacity |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
90 |
// - eden_used = young_gen_used - survivor_used |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
91 |
// - old_used = overall_used - young_gen_used |
9338 | 92 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
93 |
// Unfortunately, we currently only keep track of the number of |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
94 |
// currently allocated young and survivor regions + the overall used |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
95 |
// bytes in the heap, so the above can be a little inaccurate. |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
96 |
// |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
97 |
// * Min Capacity |
9338 | 98 |
// |
11579
6c94c23b3199
7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents:
11249
diff
changeset
|
99 |
// We set this to 0 for all spaces. |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
100 |
// |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
101 |
// * Max Capacity |
9338 | 102 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
103 |
// For jstat, we set the max capacity of all spaces to heap_capacity, |
11579
6c94c23b3199
7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents:
11249
diff
changeset
|
104 |
// given that we don't always have a reasonable upper bound on how big |
6c94c23b3199
7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents:
11249
diff
changeset
|
105 |
// each space can grow. For the memory pools, we make the max |
6c94c23b3199
7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents:
11249
diff
changeset
|
106 |
// capacity undefined with the exception of the old memory pool for |
6c94c23b3199
7078465: G1: Don't use the undefined value (-1) for the G1 old memory pool max size
tonyp
parents:
11249
diff
changeset
|
107 |
// which we make the max capacity same as the max heap capacity. |
9338 | 108 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
109 |
// If we had more accurate occupancy / capacity information per |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
110 |
// region set the above calculations would be greatly simplified and |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
111 |
// be made more accurate. |
9338 | 112 |
// |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
113 |
// We update all the above synchronously and we store the results in |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
114 |
// fields so that we just read said fields when needed. A subtle point |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
115 |
// is that all the above sizes need to be recalculated when the old |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
116 |
// gen changes capacity (after a GC or after a humongous allocation) |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
117 |
// but only the eden occupancy changes when a new eden region is |
22551 | 118 |
// allocated. So, in the latter case we have minimal recalculation to |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
119 |
// do which is important as we want to keep the eden region allocation |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
120 |
// path as low-overhead as possible. |
9338 | 121 |
|
13195 | 122 |
class G1MonitoringSupport : public CHeapObj<mtGC> { |
10675
8b887b2cb116
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
10671
diff
changeset
|
123 |
friend class VMStructs; |
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
124 |
friend class G1MonitoringScope; |
10675
8b887b2cb116
7097048: G1: extend the G1 SA changes to print per-heap space information
tonyp
parents:
10671
diff
changeset
|
125 |
|
9338 | 126 |
G1CollectedHeap* _g1h; |
127 |
||
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
128 |
// java.lang.management MemoryManager and MemoryPool support |
51498 | 129 |
GCMemoryManager _incremental_memory_manager; |
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
130 |
GCMemoryManager _full_gc_memory_manager; |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
131 |
|
51498 | 132 |
MemoryPool* _eden_space_pool; |
133 |
MemoryPool* _survivor_space_pool; |
|
134 |
MemoryPool* _old_gen_pool; |
|
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
135 |
|
9338 | 136 |
// jstat performance counters |
11249 | 137 |
// incremental collections both young and mixed |
9338 | 138 |
CollectorCounters* _incremental_collection_counters; |
139 |
// full stop-the-world collections |
|
140 |
CollectorCounters* _full_collection_counters; |
|
49377
ecd91135d645
8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents:
48116
diff
changeset
|
141 |
// stop-the-world phases in G1 |
ecd91135d645
8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents:
48116
diff
changeset
|
142 |
CollectorCounters* _conc_collection_counters; |
9338 | 143 |
// young collection set counters. The _eden_counters, |
144 |
// _from_counters, and _to_counters are associated with |
|
145 |
// this "generational" counter. |
|
51498 | 146 |
GenerationCounters* _young_gen_counters; |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
147 |
// old collection set counters. The _old_space_counters |
9338 | 148 |
// below are associated with this "generational" counter. |
51498 | 149 |
GenerationCounters* _old_gen_counters; |
9338 | 150 |
// Counters for the capacity and used for |
151 |
// the whole heap |
|
152 |
HSpaceCounters* _old_space_counters; |
|
153 |
// the young collection |
|
51498 | 154 |
HSpaceCounters* _eden_space_counters; |
9338 | 155 |
// the survivor collection (only one, _to_counters, is actively used) |
51498 | 156 |
HSpaceCounters* _from_space_counters; |
157 |
HSpaceCounters* _to_space_counters; |
|
9338 | 158 |
|
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
159 |
// When it's appropriate to recalculate the various sizes (at the |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
160 |
// end of a GC, when a new eden region is allocated, etc.) we store |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
161 |
// them here so that we can easily report them when needed and not |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
162 |
// have to recalculate them every time. |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
163 |
|
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
164 |
size_t _overall_committed; |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
165 |
size_t _overall_used; |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
166 |
|
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
167 |
size_t _young_gen_committed; |
51498 | 168 |
size_t _old_gen_committed; |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
169 |
|
51498 | 170 |
size_t _eden_space_committed; |
171 |
size_t _eden_space_used; |
|
172 |
size_t _survivor_space_committed; |
|
173 |
size_t _survivor_space_used; |
|
174 |
||
175 |
size_t _old_gen_used; |
|
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
176 |
|
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
177 |
// Recalculate all the sizes. |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
178 |
void recalculate_sizes(); |
51498 | 179 |
|
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
180 |
void recalculate_eden_size(); |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
181 |
|
51498 | 182 |
public: |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
183 |
G1MonitoringSupport(G1CollectedHeap* g1h); |
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
184 |
~G1MonitoringSupport(); |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
185 |
|
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
186 |
void initialize_serviceability(); |
51625
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
187 |
|
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
188 |
MemoryUsage memory_usage(); |
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
189 |
GrowableArray<GCMemoryManager*> memory_managers(); |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
190 |
GrowableArray<MemoryPool*> memory_pools(); |
9338 | 191 |
|
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
192 |
// Unfortunately, the jstat tool assumes that no space has 0 |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
193 |
// capacity. In our case, given that each space is logical, it's |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
194 |
// possible that no regions will be allocated to it, hence to have 0 |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
195 |
// capacity (e.g., if there are no survivor regions, the survivor |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
196 |
// space has 0 capacity). The way we deal with this is to always pad |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
197 |
// each capacity value we report to jstat by a very small amount to |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
198 |
// make sure that it's never zero. Given that we sometimes have to |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
199 |
// report a capacity of a generation that contains several spaces |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
200 |
// (e.g., young gen includes one eden, two survivor spaces), the |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
201 |
// mult parameter is provided in order to adding the appropriate |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
202 |
// padding multiple times so that the capacities add up correctly. |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
203 |
static size_t pad_capacity(size_t size_bytes, size_t mult = 1) { |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
204 |
return size_bytes + MinObjAlignmentInBytes * mult; |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
205 |
} |
9338 | 206 |
|
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
207 |
// Recalculate all the sizes from scratch and update all the jstat |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
208 |
// counters accordingly. |
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
209 |
void update_sizes(); |
51498 | 210 |
|
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
211 |
void update_eden_size(); |
9338 | 212 |
|
49377
ecd91135d645
8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents:
48116
diff
changeset
|
213 |
CollectorCounters* conc_collection_counters() { |
ecd91135d645
8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents:
48116
diff
changeset
|
214 |
return _conc_collection_counters; |
ecd91135d645
8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents:
48116
diff
changeset
|
215 |
} |
9338 | 216 |
|
217 |
// Monitoring support used by |
|
218 |
// MemoryService |
|
219 |
// jstat counters |
|
18025 | 220 |
// Tracing |
51625
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
221 |
// Values may not be consistent wrt to each other. |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
222 |
|
51498 | 223 |
size_t young_gen_committed() { return _young_gen_committed; } |
9338 | 224 |
|
51498 | 225 |
size_t eden_space_used() { return _eden_space_used; } |
226 |
size_t survivor_space_used() { return _survivor_space_used; } |
|
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
227 |
|
51498 | 228 |
size_t old_gen_committed() { return _old_gen_committed; } |
229 |
size_t old_gen_used() { return _old_gen_used; } |
|
51625
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
230 |
|
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
231 |
// Monitoring support for MemoryPools. Values in the returned MemoryUsage are |
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
232 |
// guaranteed to be consistent with each other. |
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
233 |
MemoryUsage eden_space_memory_usage(size_t initial_size, size_t max_size); |
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
234 |
MemoryUsage survivor_space_memory_usage(size_t initial_size, size_t max_size); |
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
235 |
|
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
51498
diff
changeset
|
236 |
MemoryUsage old_gen_memory_usage(size_t initial_size, size_t max_size); |
10671
431ff8629f97
7075646: G1: fix inconsistencies in the monitoring data
tonyp
parents:
9338
diff
changeset
|
237 |
}; |
9338 | 238 |
|
51497
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
239 |
// Scope object for java.lang.management support. |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
240 |
class G1MonitoringScope : public StackObj { |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
241 |
TraceCollectorStats _tcs; |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
242 |
TraceMemoryManagerStats _tms; |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
243 |
public: |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
244 |
G1MonitoringScope(G1MonitoringSupport* g1mm, bool full_gc, bool all_memory_pools_affected); |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
245 |
}; |
ec014e5694ec
8209061: Move G1 serviceability functionality to G1MonitoringSupport
tschatzl
parents:
49806
diff
changeset
|
246 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51625
diff
changeset
|
247 |
#endif // SHARE_GC_G1_G1MONITORINGSUPPORT_HPP |