author | stefank |
Thu, 13 Apr 2017 09:57:51 +0200 | |
changeset 46620 | 750c6edff33b |
parent 46329 | 53ccc37bda19 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
35520
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4459
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4459
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4459
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/systemDictionary.hpp" |
|
27 |
#include "classfile/vmSymbols.hpp" |
|
30764 | 28 |
#include "gc/parallel/mutableSpace.hpp" |
29 |
#include "gc/serial/defNewGeneration.hpp" |
|
30 |
#include "gc/serial/tenuredGeneration.hpp" |
|
31 |
#include "gc/shared/collectorPolicy.hpp" |
|
32 |
#include "gc/shared/genCollectedHeap.hpp" |
|
33 |
#include "gc/shared/generation.hpp" |
|
34 |
#include "gc/shared/generationSpec.hpp" |
|
35061 | 35 |
#include "logging/logConfiguration.hpp" |
7397 | 36 |
#include "memory/heap.hpp" |
37 |
#include "memory/memRegion.hpp" |
|
38 |
#include "oops/oop.inline.hpp" |
|
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
39 |
#include "runtime/globals.hpp" |
7397 | 40 |
#include "runtime/javaCalls.hpp" |
41 |
#include "services/classLoadingService.hpp" |
|
42 |
#include "services/lowMemoryDetector.hpp" |
|
43 |
#include "services/management.hpp" |
|
44 |
#include "services/memoryManager.hpp" |
|
45 |
#include "services/memoryPool.hpp" |
|
46 |
#include "services/memoryService.hpp" |
|
47 |
#include "utilities/growableArray.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
48 |
#include "utilities/macros.hpp" |
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
49 |
#if INCLUDE_ALL_GCS |
30764 | 50 |
#include "gc/cms/concurrentMarkSweepGeneration.hpp" |
51 |
#include "gc/cms/parNewGeneration.hpp" |
|
52 |
#include "gc/g1/g1CollectedHeap.inline.hpp" |
|
53 |
#include "gc/parallel/parallelScavengeHeap.hpp" |
|
54 |
#include "gc/parallel/psOldGen.hpp" |
|
55 |
#include "gc/parallel/psYoungGen.hpp" |
|
7397 | 56 |
#include "services/g1MemoryPool.hpp" |
57 |
#include "services/psMemoryPool.hpp" |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
58 |
#endif // INCLUDE_ALL_GCS |
1 | 59 |
|
60 |
GrowableArray<MemoryPool*>* MemoryService::_pools_list = |
|
13195 | 61 |
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_pools_list_size, true); |
1 | 62 |
GrowableArray<MemoryManager*>* MemoryService::_managers_list = |
13195 | 63 |
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryManager*>(init_managers_list_size, true); |
1 | 64 |
|
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
65 |
GCMemoryManager* MemoryService::_minor_gc_manager = NULL; |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
66 |
GCMemoryManager* MemoryService::_major_gc_manager = NULL; |
26796 | 67 |
MemoryManager* MemoryService::_code_cache_manager = NULL; |
68 |
GrowableArray<MemoryPool*>* MemoryService::_code_heap_pools = |
|
69 |
new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_code_heap_pools_size, true); |
|
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
70 |
MemoryPool* MemoryService::_metaspace_pool = NULL; |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
71 |
MemoryPool* MemoryService::_compressed_class_pool = NULL; |
1 | 72 |
|
73 |
class GcThreadCountClosure: public ThreadClosure { |
|
74 |
private: |
|
75 |
int _count; |
|
76 |
public: |
|
77 |
GcThreadCountClosure() : _count(0) {}; |
|
78 |
void do_thread(Thread* thread); |
|
79 |
int count() { return _count; } |
|
80 |
}; |
|
81 |
||
82 |
void GcThreadCountClosure::do_thread(Thread* thread) { |
|
83 |
_count++; |
|
84 |
} |
|
85 |
||
86 |
void MemoryService::set_universe_heap(CollectedHeap* heap) { |
|
87 |
CollectedHeap::Name kind = heap->kind(); |
|
88 |
switch (kind) { |
|
89 |
case CollectedHeap::GenCollectedHeap : { |
|
90 |
add_gen_collected_heap_info(GenCollectedHeap::heap()); |
|
91 |
break; |
|
92 |
} |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
93 |
#if INCLUDE_ALL_GCS |
1 | 94 |
case CollectedHeap::ParallelScavengeHeap : { |
95 |
add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap()); |
|
96 |
break; |
|
97 |
} |
|
1374 | 98 |
case CollectedHeap::G1CollectedHeap : { |
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
99 |
add_g1_heap_info(G1CollectedHeap::heap()); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
100 |
break; |
1374 | 101 |
} |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
102 |
#endif // INCLUDE_ALL_GCS |
1 | 103 |
default: { |
1374 | 104 |
guarantee(false, "Unrecognized kind of heap"); |
1 | 105 |
} |
106 |
} |
|
107 |
||
108 |
// set the GC thread count |
|
109 |
GcThreadCountClosure gctcc; |
|
110 |
heap->gc_threads_do(&gctcc); |
|
111 |
int count = gctcc.count(); |
|
112 |
if (count > 0) { |
|
113 |
_minor_gc_manager->set_num_gc_threads(count); |
|
114 |
_major_gc_manager->set_num_gc_threads(count); |
|
115 |
} |
|
116 |
||
117 |
// All memory pools and memory managers are initialized. |
|
118 |
// |
|
119 |
_minor_gc_manager->initialize_gc_stat_info(); |
|
120 |
_major_gc_manager->initialize_gc_stat_info(); |
|
121 |
} |
|
122 |
||
123 |
// Add memory pools for GenCollectedHeap |
|
124 |
// This function currently only supports two generations collected heap. |
|
125 |
// The collector for GenCollectedHeap will have two memory managers. |
|
126 |
void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) { |
|
127 |
CollectorPolicy* policy = heap->collector_policy(); |
|
128 |
||
24353
148147d21135
8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
jwilhelm
parents:
22234
diff
changeset
|
129 |
assert(policy->is_generation_policy(), "Only support two generations"); |
148147d21135
8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
jwilhelm
parents:
22234
diff
changeset
|
130 |
GenCollectorPolicy* gen_policy = policy->as_generation_policy(); |
148147d21135
8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
jwilhelm
parents:
22234
diff
changeset
|
131 |
if (gen_policy != NULL) { |
29794 | 132 |
Generation::Name kind = gen_policy->young_gen_spec()->name(); |
1 | 133 |
switch (kind) { |
134 |
case Generation::DefNew: |
|
135 |
_minor_gc_manager = MemoryManager::get_copy_memory_manager(); |
|
136 |
break; |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
137 |
#if INCLUDE_ALL_GCS |
1 | 138 |
case Generation::ParNew: |
139 |
_minor_gc_manager = MemoryManager::get_parnew_memory_manager(); |
|
140 |
break; |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
141 |
#endif // INCLUDE_ALL_GCS |
1 | 142 |
default: |
143 |
guarantee(false, "Unrecognized generation spec"); |
|
144 |
break; |
|
145 |
} |
|
146 |
if (policy->is_mark_sweep_policy()) { |
|
147 |
_major_gc_manager = MemoryManager::get_msc_memory_manager(); |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
148 |
#if INCLUDE_ALL_GCS |
1 | 149 |
} else if (policy->is_concurrent_mark_sweep_policy()) { |
150 |
_major_gc_manager = MemoryManager::get_cms_memory_manager(); |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
151 |
#endif // INCLUDE_ALL_GCS |
1 | 152 |
} else { |
153 |
guarantee(false, "Unknown two-gen policy"); |
|
154 |
} |
|
155 |
} else { |
|
156 |
guarantee(false, "Non two-gen policy"); |
|
157 |
} |
|
158 |
_managers_list->append(_minor_gc_manager); |
|
159 |
_managers_list->append(_major_gc_manager); |
|
160 |
||
29684
a36d90acae41
8057632: Remove auxiliary code used to handle the generations array
jwilhelm
parents:
26796
diff
changeset
|
161 |
add_generation_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager); |
a36d90acae41
8057632: Remove auxiliary code used to handle the generations array
jwilhelm
parents:
26796
diff
changeset
|
162 |
add_generation_memory_pool(heap->old_gen(), _major_gc_manager); |
1 | 163 |
} |
164 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
165 |
#if INCLUDE_ALL_GCS |
1 | 166 |
// Add memory pools for ParallelScavengeHeap |
167 |
// This function currently only supports two generations collected heap. |
|
168 |
// The collector for ParallelScavengeHeap will have two memory managers. |
|
169 |
void MemoryService::add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap) { |
|
170 |
// Two managers to keep statistics about _minor_gc_manager and _major_gc_manager GC. |
|
171 |
_minor_gc_manager = MemoryManager::get_psScavenge_memory_manager(); |
|
172 |
_major_gc_manager = MemoryManager::get_psMarkSweep_memory_manager(); |
|
173 |
_managers_list->append(_minor_gc_manager); |
|
174 |
_managers_list->append(_major_gc_manager); |
|
175 |
||
176 |
add_psYoung_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager); |
|
177 |
add_psOld_memory_pool(heap->old_gen(), _major_gc_manager); |
|
178 |
} |
|
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
179 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
180 |
void MemoryService::add_g1_heap_info(G1CollectedHeap* g1h) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
181 |
assert(UseG1GC, "sanity"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
182 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
183 |
_minor_gc_manager = MemoryManager::get_g1YoungGen_memory_manager(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
184 |
_major_gc_manager = MemoryManager::get_g1OldGen_memory_manager(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
185 |
_managers_list->append(_minor_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
186 |
_managers_list->append(_major_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
187 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
188 |
add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
189 |
add_g1OldGen_memory_pool(g1h, _major_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
190 |
} |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
191 |
#endif // INCLUDE_ALL_GCS |
1 | 192 |
|
193 |
MemoryPool* MemoryService::add_gen(Generation* gen, |
|
194 |
const char* name, |
|
195 |
bool is_heap, |
|
196 |
bool support_usage_threshold) { |
|
197 |
||
198 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
199 |
GenerationPool* pool = new GenerationPool(gen, name, type, support_usage_threshold); |
|
200 |
_pools_list->append(pool); |
|
201 |
return (MemoryPool*) pool; |
|
202 |
} |
|
203 |
||
204 |
MemoryPool* MemoryService::add_space(ContiguousSpace* space, |
|
205 |
const char* name, |
|
206 |
bool is_heap, |
|
207 |
size_t max_size, |
|
208 |
bool support_usage_threshold) { |
|
209 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
210 |
ContiguousSpacePool* pool = new ContiguousSpacePool(space, name, type, max_size, support_usage_threshold); |
|
211 |
||
212 |
_pools_list->append(pool); |
|
213 |
return (MemoryPool*) pool; |
|
214 |
} |
|
215 |
||
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
216 |
MemoryPool* MemoryService::add_survivor_spaces(DefNewGeneration* young_gen, |
1 | 217 |
const char* name, |
218 |
bool is_heap, |
|
219 |
size_t max_size, |
|
220 |
bool support_usage_threshold) { |
|
221 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
222 |
SurvivorContiguousSpacePool* pool = new SurvivorContiguousSpacePool(young_gen, name, type, max_size, support_usage_threshold); |
1 | 223 |
|
224 |
_pools_list->append(pool); |
|
225 |
return (MemoryPool*) pool; |
|
226 |
} |
|
227 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
228 |
#if INCLUDE_ALL_GCS |
1 | 229 |
MemoryPool* MemoryService::add_cms_space(CompactibleFreeListSpace* space, |
230 |
const char* name, |
|
231 |
bool is_heap, |
|
232 |
size_t max_size, |
|
233 |
bool support_usage_threshold) { |
|
234 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
235 |
CompactibleFreeListSpacePool* pool = new CompactibleFreeListSpacePool(space, name, type, max_size, support_usage_threshold); |
|
236 |
_pools_list->append(pool); |
|
237 |
return (MemoryPool*) pool; |
|
238 |
} |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
239 |
#endif // INCLUDE_ALL_GCS |
1 | 240 |
|
241 |
// Add memory pool(s) for one generation |
|
242 |
void MemoryService::add_generation_memory_pool(Generation* gen, |
|
243 |
MemoryManager* major_mgr, |
|
244 |
MemoryManager* minor_mgr) { |
|
16362
7b5c4f403e90
8009156: [parfait] Null pointer deference in hotspot/src/share/vm/services/memoryService.cpp
morris
parents:
15482
diff
changeset
|
245 |
guarantee(gen != NULL, "No generation for memory pool"); |
1 | 246 |
Generation::Name kind = gen->kind(); |
247 |
int index = _pools_list->length(); |
|
248 |
||
249 |
switch (kind) { |
|
250 |
case Generation::DefNew: { |
|
251 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
|
252 |
DefNewGeneration* young_gen = (DefNewGeneration*) gen; |
|
253 |
// Add a memory pool for each space and young gen doesn't |
|
254 |
// support low memory detection as it is expected to get filled up. |
|
255 |
MemoryPool* eden = add_space(young_gen->eden(), |
|
256 |
"Eden Space", |
|
257 |
true, /* is_heap */ |
|
258 |
young_gen->max_eden_size(), |
|
259 |
false /* support_usage_threshold */); |
|
260 |
MemoryPool* survivor = add_survivor_spaces(young_gen, |
|
261 |
"Survivor Space", |
|
262 |
true, /* is_heap */ |
|
263 |
young_gen->max_survivor_size(), |
|
264 |
false /* support_usage_threshold */); |
|
265 |
break; |
|
266 |
} |
|
267 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
268 |
#if INCLUDE_ALL_GCS |
1 | 269 |
case Generation::ParNew: |
270 |
{ |
|
271 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
|
272 |
// Add a memory pool for each space and young gen doesn't |
|
273 |
// support low memory detection as it is expected to get filled up. |
|
274 |
ParNewGeneration* parnew_gen = (ParNewGeneration*) gen; |
|
275 |
MemoryPool* eden = add_space(parnew_gen->eden(), |
|
276 |
"Par Eden Space", |
|
277 |
true /* is_heap */, |
|
278 |
parnew_gen->max_eden_size(), |
|
279 |
false /* support_usage_threshold */); |
|
280 |
MemoryPool* survivor = add_survivor_spaces(parnew_gen, |
|
281 |
"Par Survivor Space", |
|
282 |
true, /* is_heap */ |
|
283 |
parnew_gen->max_survivor_size(), |
|
284 |
false /* support_usage_threshold */); |
|
285 |
||
286 |
break; |
|
287 |
} |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
288 |
#endif // INCLUDE_ALL_GCS |
1 | 289 |
|
290 |
case Generation::MarkSweepCompact: { |
|
291 |
assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); |
|
292 |
add_gen(gen, |
|
293 |
"Tenured Gen", |
|
294 |
true, /* is_heap */ |
|
295 |
true /* support_usage_threshold */); |
|
296 |
break; |
|
297 |
} |
|
298 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
299 |
#if INCLUDE_ALL_GCS |
1 | 300 |
case Generation::ConcurrentMarkSweep: |
301 |
{ |
|
302 |
assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); |
|
303 |
ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*) gen; |
|
304 |
MemoryPool* pool = add_cms_space(cms->cmsSpace(), |
|
305 |
"CMS Old Gen", |
|
306 |
true, /* is_heap */ |
|
307 |
cms->reserved().byte_size(), |
|
308 |
true /* support_usage_threshold */); |
|
309 |
break; |
|
310 |
} |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
311 |
#endif // INCLUDE_ALL_GCS |
1 | 312 |
|
313 |
default: |
|
314 |
assert(false, "should not reach here"); |
|
315 |
// no memory pool added for others |
|
316 |
break; |
|
317 |
} |
|
318 |
||
319 |
assert(major_mgr != NULL, "Should have at least one manager"); |
|
320 |
// Link managers and the memory pools together |
|
321 |
for (int i = index; i < _pools_list->length(); i++) { |
|
322 |
MemoryPool* pool = _pools_list->at(i); |
|
323 |
major_mgr->add_pool(pool); |
|
324 |
if (minor_mgr != NULL) { |
|
325 |
minor_mgr->add_pool(pool); |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
329 |
||
330 |
||
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
331 |
#if INCLUDE_ALL_GCS |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
332 |
void MemoryService::add_psYoung_memory_pool(PSYoungGen* young_gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) { |
1 | 333 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
334 |
||
335 |
// Add a memory pool for each space and young gen doesn't |
|
336 |
// support low memory detection as it is expected to get filled up. |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
337 |
EdenMutableSpacePool* eden = new EdenMutableSpacePool(young_gen, |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
338 |
young_gen->eden_space(), |
1 | 339 |
"PS Eden Space", |
340 |
MemoryPool::Heap, |
|
341 |
false /* support_usage_threshold */); |
|
342 |
||
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
343 |
SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(young_gen, |
1 | 344 |
"PS Survivor Space", |
345 |
MemoryPool::Heap, |
|
346 |
false /* support_usage_threshold */); |
|
347 |
||
348 |
major_mgr->add_pool(eden); |
|
349 |
major_mgr->add_pool(survivor); |
|
350 |
minor_mgr->add_pool(eden); |
|
351 |
minor_mgr->add_pool(survivor); |
|
352 |
_pools_list->append(eden); |
|
353 |
_pools_list->append(survivor); |
|
354 |
} |
|
355 |
||
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
356 |
void MemoryService::add_psOld_memory_pool(PSOldGen* old_gen, MemoryManager* mgr) { |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
357 |
PSGenerationPool* old_gen_pool = new PSGenerationPool(old_gen, |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
358 |
"PS Old Gen", |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
359 |
MemoryPool::Heap, |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
360 |
true /* support_usage_threshold */); |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
361 |
mgr->add_pool(old_gen_pool); |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
362 |
_pools_list->append(old_gen_pool); |
1 | 363 |
} |
364 |
||
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
365 |
void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
366 |
MemoryManager* major_mgr, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
367 |
MemoryManager* minor_mgr) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
368 |
assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
369 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
370 |
G1EdenPool* eden = new G1EdenPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
371 |
G1SurvivorPool* survivor = new G1SurvivorPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
372 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
373 |
major_mgr->add_pool(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
374 |
major_mgr->add_pool(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
375 |
minor_mgr->add_pool(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
376 |
minor_mgr->add_pool(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
377 |
_pools_list->append(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
378 |
_pools_list->append(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
379 |
} |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
380 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
381 |
void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
382 |
MemoryManager* mgr) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
383 |
assert(mgr != NULL, "should have one manager"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
384 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
385 |
G1OldGenPool* old_gen = new G1OldGenPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
386 |
mgr->add_pool(old_gen); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
387 |
_pools_list->append(old_gen); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
388 |
} |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
389 |
#endif // INCLUDE_ALL_GCS |
1 | 390 |
|
26796 | 391 |
void MemoryService::add_code_heap_memory_pool(CodeHeap* heap, const char* name) { |
392 |
// Create new memory pool for this heap |
|
393 |
MemoryPool* code_heap_pool = new CodeHeapPool(heap, name, true /* support_usage_threshold */); |
|
394 |
||
395 |
// Append to lists |
|
396 |
_code_heap_pools->append(code_heap_pool); |
|
397 |
_pools_list->append(code_heap_pool); |
|
1 | 398 |
|
26796 | 399 |
if (_code_cache_manager == NULL) { |
400 |
// Create CodeCache memory manager |
|
401 |
_code_cache_manager = MemoryManager::get_code_cache_memory_manager(); |
|
402 |
_managers_list->append(_code_cache_manager); |
|
403 |
} |
|
404 |
||
405 |
_code_cache_manager->add_pool(code_heap_pool); |
|
1 | 406 |
} |
407 |
||
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
408 |
void MemoryService::add_metaspace_memory_pools() { |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
409 |
MemoryManager* mgr = MemoryManager::get_metaspace_memory_manager(); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
410 |
|
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
411 |
_metaspace_pool = new MetaspacePool(); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
412 |
mgr->add_pool(_metaspace_pool); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
413 |
_pools_list->append(_metaspace_pool); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
414 |
|
19979
ebe1dbb6e1aa
8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents:
18444
diff
changeset
|
415 |
if (UseCompressedClassPointers) { |
18444
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
416 |
_compressed_class_pool = new CompressedKlassSpacePool(); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
417 |
mgr->add_pool(_compressed_class_pool); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
418 |
_pools_list->append(_compressed_class_pool); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
419 |
} |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
420 |
|
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
421 |
_managers_list->append(mgr); |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
422 |
} |
8adb4bc92f18
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
16453
diff
changeset
|
423 |
|
1 | 424 |
MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) { |
425 |
for (int i = 0; i < _managers_list->length(); i++) { |
|
426 |
MemoryManager* mgr = _managers_list->at(i); |
|
427 |
if (mgr->is_manager(mh)) { |
|
428 |
return mgr; |
|
429 |
} |
|
430 |
} |
|
431 |
return NULL; |
|
432 |
} |
|
433 |
||
434 |
MemoryPool* MemoryService::get_memory_pool(instanceHandle ph) { |
|
435 |
for (int i = 0; i < _pools_list->length(); i++) { |
|
436 |
MemoryPool* pool = _pools_list->at(i); |
|
437 |
if (pool->is_pool(ph)) { |
|
438 |
return pool; |
|
439 |
} |
|
440 |
} |
|
441 |
return NULL; |
|
442 |
} |
|
443 |
||
444 |
void MemoryService::track_memory_usage() { |
|
445 |
// Track the peak memory usage |
|
446 |
for (int i = 0; i < _pools_list->length(); i++) { |
|
447 |
MemoryPool* pool = _pools_list->at(i); |
|
448 |
pool->record_peak_memory_usage(); |
|
449 |
} |
|
450 |
||
451 |
// Detect low memory |
|
452 |
LowMemoryDetector::detect_low_memory(); |
|
453 |
} |
|
454 |
||
455 |
void MemoryService::track_memory_pool_usage(MemoryPool* pool) { |
|
456 |
// Track the peak memory usage |
|
457 |
pool->record_peak_memory_usage(); |
|
458 |
||
459 |
// Detect low memory |
|
460 |
if (LowMemoryDetector::is_enabled(pool)) { |
|
461 |
LowMemoryDetector::detect_low_memory(pool); |
|
462 |
} |
|
463 |
} |
|
464 |
||
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
465 |
void MemoryService::gc_begin(bool fullGC, bool recordGCBeginTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
466 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
467 |
bool recordPreGCUsage, bool recordPeakUsage) { |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
468 |
|
1 | 469 |
GCMemoryManager* mgr; |
470 |
if (fullGC) { |
|
471 |
mgr = _major_gc_manager; |
|
472 |
} else { |
|
473 |
mgr = _minor_gc_manager; |
|
474 |
} |
|
475 |
assert(mgr->is_gc_memory_manager(), "Sanity check"); |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
476 |
mgr->gc_begin(recordGCBeginTime, recordPreGCUsage, recordAccumulatedGCTime); |
1 | 477 |
|
478 |
// Track the peak memory usage when GC begins |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
479 |
if (recordPeakUsage) { |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
480 |
for (int i = 0; i < _pools_list->length(); i++) { |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
481 |
MemoryPool* pool = _pools_list->at(i); |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
482 |
pool->record_peak_memory_usage(); |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
483 |
} |
1 | 484 |
} |
485 |
} |
|
486 |
||
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
487 |
void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
488 |
bool recordAccumulatedGCTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
489 |
bool recordGCEndTime, bool countCollection, |
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
490 |
GCCause::Cause cause) { |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
491 |
|
1 | 492 |
GCMemoryManager* mgr; |
493 |
if (fullGC) { |
|
494 |
mgr = (GCMemoryManager*) _major_gc_manager; |
|
495 |
} else { |
|
496 |
mgr = (GCMemoryManager*) _minor_gc_manager; |
|
497 |
} |
|
498 |
assert(mgr->is_gc_memory_manager(), "Sanity check"); |
|
499 |
||
500 |
// register the GC end statistics and memory usage |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
501 |
mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
502 |
countCollection, cause); |
1 | 503 |
} |
504 |
||
505 |
void MemoryService::oops_do(OopClosure* f) { |
|
506 |
int i; |
|
507 |
||
508 |
for (i = 0; i < _pools_list->length(); i++) { |
|
509 |
MemoryPool* pool = _pools_list->at(i); |
|
510 |
pool->oops_do(f); |
|
511 |
} |
|
512 |
for (i = 0; i < _managers_list->length(); i++) { |
|
513 |
MemoryManager* mgr = _managers_list->at(i); |
|
514 |
mgr->oops_do(f); |
|
515 |
} |
|
516 |
} |
|
517 |
||
518 |
bool MemoryService::set_verbose(bool verbose) { |
|
519 |
MutexLocker m(Management_lock); |
|
520 |
// verbose will be set to the previous value |
|
35061 | 521 |
if (verbose) { |
35520
0efb779f41a5
8147464: Use LogConfiguration::configure_stdout() instead of parse_log_arguments
brutisso
parents:
35228
diff
changeset
|
522 |
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); |
35061 | 523 |
} else { |
35520
0efb779f41a5
8147464: Use LogConfiguration::configure_stdout() instead of parse_log_arguments
brutisso
parents:
35228
diff
changeset
|
524 |
LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(gc)); |
35061 | 525 |
} |
1 | 526 |
ClassLoadingService::reset_trace_class_unloading(); |
527 |
||
528 |
return verbose; |
|
529 |
} |
|
530 |
||
531 |
Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
35520
diff
changeset
|
532 |
InstanceKlass* ik = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); |
1 | 533 |
|
534 |
instanceHandle obj = ik->allocate_instance_handle(CHECK_NH); |
|
535 |
||
536 |
JavaValue result(T_VOID); |
|
537 |
JavaCallArguments args(10); |
|
538 |
args.push_oop(obj); // receiver |
|
539 |
args.push_long(usage.init_size_as_jlong()); // Argument 1 |
|
540 |
args.push_long(usage.used_as_jlong()); // Argument 2 |
|
541 |
args.push_long(usage.committed_as_jlong()); // Argument 3 |
|
542 |
args.push_long(usage.max_size_as_jlong()); // Argument 4 |
|
543 |
||
544 |
JavaCalls::call_special(&result, |
|
545 |
ik, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
546 |
vmSymbols::object_initializer_name(), |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
547 |
vmSymbols::long_long_long_long_void_signature(), |
1 | 548 |
&args, |
549 |
CHECK_NH); |
|
550 |
return obj; |
|
551 |
} |
|
33794 | 552 |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
553 |
// GC manager type depends on the type of Generation. Depending on the space |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31373
diff
changeset
|
554 |
// availability and vm options the gc uses major gc manager or minor gc |
1 | 555 |
// manager or both. The type of gc manager depends on the generation kind. |
25485
9c3d427eed01
8034246: remove CMS and ParNew adaptive size policy code
jcoomes
parents:
24353
diff
changeset
|
556 |
// For DefNew and ParNew generation doing scavenge gc uses minor gc manager (so |
9c3d427eed01
8034246: remove CMS and ParNew adaptive size policy code
jcoomes
parents:
24353
diff
changeset
|
557 |
// _fullGC is set to false ) and for other generation kinds doing |
9c3d427eed01
8034246: remove CMS and ParNew adaptive size policy code
jcoomes
parents:
24353
diff
changeset
|
558 |
// mark-sweep-compact uses major gc manager (so _fullGC is set to true). |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
559 |
TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) { |
1 | 560 |
switch (kind) { |
561 |
case Generation::DefNew: |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
562 |
#if INCLUDE_ALL_GCS |
1 | 563 |
case Generation::ParNew: |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
564 |
#endif // INCLUDE_ALL_GCS |
33794 | 565 |
_fullGC = false; |
1 | 566 |
break; |
567 |
case Generation::MarkSweepCompact: |
|
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
568 |
#if INCLUDE_ALL_GCS |
1 | 569 |
case Generation::ConcurrentMarkSweep: |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
13728
diff
changeset
|
570 |
#endif // INCLUDE_ALL_GCS |
33794 | 571 |
_fullGC = true; |
1 | 572 |
break; |
573 |
default: |
|
33794 | 574 |
_fullGC = false; |
1 | 575 |
assert(false, "Unrecognized gc generation kind."); |
576 |
} |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
577 |
// this has to be called in a stop the world pause and represent |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
578 |
// an entire gc pause, start to finish: |
33794 | 579 |
initialize(_fullGC, cause, true, true, true, true, true, true, true); |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
580 |
} |
33794 | 581 |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
582 |
TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
583 |
GCCause::Cause cause, |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
584 |
bool recordGCBeginTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
585 |
bool recordPreGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
586 |
bool recordPeakUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
587 |
bool recordPostGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
588 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
589 |
bool recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
590 |
bool countCollection) { |
33794 | 591 |
initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage, |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
592 |
recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
593 |
countCollection); |
1 | 594 |
} |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
595 |
|
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
596 |
// for a subclass to create then initialize an instance before invoking |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
597 |
// the MemoryService |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
598 |
void TraceMemoryManagerStats::initialize(bool fullGC, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
599 |
GCCause::Cause cause, |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
600 |
bool recordGCBeginTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
601 |
bool recordPreGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
602 |
bool recordPeakUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
603 |
bool recordPostGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
604 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
605 |
bool recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
606 |
bool countCollection) { |
1 | 607 |
_fullGC = fullGC; |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
608 |
_recordGCBeginTime = recordGCBeginTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
609 |
_recordPreGCUsage = recordPreGCUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
610 |
_recordPeakUsage = recordPeakUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
611 |
_recordPostGCUsage = recordPostGCUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
612 |
_recordAccumulatedGCTime = recordAccumulatedGCTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
613 |
_recordGCEndTime = recordGCEndTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
614 |
_countCollection = countCollection; |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
615 |
_cause = cause; |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
616 |
|
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
617 |
MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
618 |
_recordPreGCUsage, _recordPeakUsage); |
1 | 619 |
} |
620 |
||
621 |
TraceMemoryManagerStats::~TraceMemoryManagerStats() { |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
622 |
MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
623 |
_recordGCEndTime, _countCollection, _cause); |
1 | 624 |
} |