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