author | coleenp |
Fri, 23 Mar 2012 11:16:05 -0400 | |
changeset 12263 | d20640f4f8fe |
parent 9623 | 151c0b638488 |
child 13195 | be27e1b6a4b9 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
8921
14bfe81f2a9d
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents:
8076
diff
changeset
|
2 |
* Copyright (c) 2003, 2011, 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" |
|
28 |
#include "gc_implementation/shared/mutableSpace.hpp" |
|
29 |
#include "memory/collectorPolicy.hpp" |
|
30 |
#include "memory/defNewGeneration.hpp" |
|
31 |
#include "memory/genCollectedHeap.hpp" |
|
32 |
#include "memory/generation.hpp" |
|
33 |
#include "memory/generationSpec.hpp" |
|
34 |
#include "memory/heap.hpp" |
|
35 |
#include "memory/memRegion.hpp" |
|
36 |
#include "memory/permGen.hpp" |
|
37 |
#include "memory/tenuredGeneration.hpp" |
|
38 |
#include "oops/oop.inline.hpp" |
|
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" |
|
47 |
#ifndef SERIALGC |
|
48 |
#include "gc_implementation/concurrentMarkSweep/cmsPermGen.hpp" |
|
49 |
#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" |
|
50 |
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
|
51 |
#include "gc_implementation/parNew/parNewGeneration.hpp" |
|
52 |
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
|
53 |
#include "gc_implementation/parallelScavenge/psOldGen.hpp" |
|
54 |
#include "gc_implementation/parallelScavenge/psPermGen.hpp" |
|
55 |
#include "gc_implementation/parallelScavenge/psYoungGen.hpp" |
|
56 |
#include "services/g1MemoryPool.hpp" |
|
57 |
#include "services/psMemoryPool.hpp" |
|
58 |
#endif |
|
1 | 59 |
|
60 |
GrowableArray<MemoryPool*>* MemoryService::_pools_list = |
|
61 |
new (ResourceObj::C_HEAP) GrowableArray<MemoryPool*>(init_pools_list_size, true); |
|
62 |
GrowableArray<MemoryManager*>* MemoryService::_managers_list = |
|
63 |
new (ResourceObj::C_HEAP) GrowableArray<MemoryManager*>(init_managers_list_size, true); |
|
64 |
||
65 |
GCMemoryManager* MemoryService::_minor_gc_manager = NULL; |
|
66 |
GCMemoryManager* MemoryService::_major_gc_manager = NULL; |
|
67 |
MemoryPool* MemoryService::_code_heap_pool = NULL; |
|
68 |
||
69 |
class GcThreadCountClosure: public ThreadClosure { |
|
70 |
private: |
|
71 |
int _count; |
|
72 |
public: |
|
73 |
GcThreadCountClosure() : _count(0) {}; |
|
74 |
void do_thread(Thread* thread); |
|
75 |
int count() { return _count; } |
|
76 |
}; |
|
77 |
||
78 |
void GcThreadCountClosure::do_thread(Thread* thread) { |
|
79 |
_count++; |
|
80 |
} |
|
81 |
||
82 |
void MemoryService::set_universe_heap(CollectedHeap* heap) { |
|
83 |
CollectedHeap::Name kind = heap->kind(); |
|
84 |
switch (kind) { |
|
85 |
case CollectedHeap::GenCollectedHeap : { |
|
86 |
add_gen_collected_heap_info(GenCollectedHeap::heap()); |
|
87 |
break; |
|
88 |
} |
|
89 |
#ifndef SERIALGC |
|
90 |
case CollectedHeap::ParallelScavengeHeap : { |
|
91 |
add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap()); |
|
92 |
break; |
|
93 |
} |
|
1374 | 94 |
case CollectedHeap::G1CollectedHeap : { |
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
95 |
add_g1_heap_info(G1CollectedHeap::heap()); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
96 |
break; |
1374 | 97 |
} |
1 | 98 |
#endif // SERIALGC |
99 |
default: { |
|
1374 | 100 |
guarantee(false, "Unrecognized kind of heap"); |
1 | 101 |
} |
102 |
} |
|
103 |
||
104 |
// set the GC thread count |
|
105 |
GcThreadCountClosure gctcc; |
|
106 |
heap->gc_threads_do(&gctcc); |
|
107 |
int count = gctcc.count(); |
|
108 |
if (count > 0) { |
|
109 |
_minor_gc_manager->set_num_gc_threads(count); |
|
110 |
_major_gc_manager->set_num_gc_threads(count); |
|
111 |
} |
|
112 |
||
113 |
// All memory pools and memory managers are initialized. |
|
114 |
// |
|
115 |
_minor_gc_manager->initialize_gc_stat_info(); |
|
116 |
_major_gc_manager->initialize_gc_stat_info(); |
|
117 |
} |
|
118 |
||
119 |
// Add memory pools for GenCollectedHeap |
|
120 |
// This function currently only supports two generations collected heap. |
|
121 |
// The collector for GenCollectedHeap will have two memory managers. |
|
122 |
void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) { |
|
123 |
CollectorPolicy* policy = heap->collector_policy(); |
|
124 |
||
125 |
assert(policy->is_two_generation_policy(), "Only support two generations"); |
|
126 |
guarantee(heap->n_gens() == 2, "Only support two-generation heap"); |
|
127 |
||
128 |
TwoGenerationCollectorPolicy* two_gen_policy = policy->as_two_generation_policy(); |
|
129 |
if (two_gen_policy != NULL) { |
|
130 |
GenerationSpec** specs = two_gen_policy->generations(); |
|
131 |
Generation::Name kind = specs[0]->name(); |
|
132 |
switch (kind) { |
|
133 |
case Generation::DefNew: |
|
134 |
_minor_gc_manager = MemoryManager::get_copy_memory_manager(); |
|
135 |
break; |
|
136 |
#ifndef SERIALGC |
|
137 |
case Generation::ParNew: |
|
138 |
case Generation::ASParNew: |
|
139 |
_minor_gc_manager = MemoryManager::get_parnew_memory_manager(); |
|
140 |
break; |
|
141 |
#endif // SERIALGC |
|
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(); |
|
148 |
#ifndef SERIALGC |
|
149 |
} else if (policy->is_concurrent_mark_sweep_policy()) { |
|
150 |
_major_gc_manager = MemoryManager::get_cms_memory_manager(); |
|
151 |
#endif // SERIALGC |
|
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 |
||
161 |
add_generation_memory_pool(heap->get_gen(minor), _major_gc_manager, _minor_gc_manager); |
|
162 |
add_generation_memory_pool(heap->get_gen(major), _major_gc_manager); |
|
163 |
||
164 |
PermGen::Name name = policy->permanent_generation()->name(); |
|
165 |
switch (name) { |
|
166 |
case PermGen::MarkSweepCompact: { |
|
167 |
CompactingPermGenGen* perm_gen = (CompactingPermGenGen*) heap->perm_gen(); |
|
168 |
add_compact_perm_gen_memory_pool(perm_gen, _major_gc_manager); |
|
169 |
break; |
|
170 |
} |
|
171 |
#ifndef SERIALGC |
|
172 |
case PermGen::ConcurrentMarkSweep: { |
|
173 |
CMSPermGenGen* cms_gen = (CMSPermGenGen*) heap->perm_gen(); |
|
174 |
add_cms_perm_gen_memory_pool(cms_gen, _major_gc_manager); |
|
175 |
break; |
|
176 |
} |
|
177 |
#endif // SERIALGC |
|
178 |
default: |
|
179 |
guarantee(false, "Unrecognized perm generation"); |
|
180 |
break; |
|
181 |
} |
|
182 |
} |
|
183 |
||
184 |
#ifndef SERIALGC |
|
185 |
// Add memory pools for ParallelScavengeHeap |
|
186 |
// This function currently only supports two generations collected heap. |
|
187 |
// The collector for ParallelScavengeHeap will have two memory managers. |
|
188 |
void MemoryService::add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap) { |
|
189 |
// Two managers to keep statistics about _minor_gc_manager and _major_gc_manager GC. |
|
190 |
_minor_gc_manager = MemoryManager::get_psScavenge_memory_manager(); |
|
191 |
_major_gc_manager = MemoryManager::get_psMarkSweep_memory_manager(); |
|
192 |
_managers_list->append(_minor_gc_manager); |
|
193 |
_managers_list->append(_major_gc_manager); |
|
194 |
||
195 |
add_psYoung_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager); |
|
196 |
add_psOld_memory_pool(heap->old_gen(), _major_gc_manager); |
|
197 |
add_psPerm_memory_pool(heap->perm_gen(), _major_gc_manager); |
|
198 |
} |
|
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
199 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
200 |
void MemoryService::add_g1_heap_info(G1CollectedHeap* g1h) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
201 |
assert(UseG1GC, "sanity"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
202 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
203 |
_minor_gc_manager = MemoryManager::get_g1YoungGen_memory_manager(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
204 |
_major_gc_manager = MemoryManager::get_g1OldGen_memory_manager(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
205 |
_managers_list->append(_minor_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
206 |
_managers_list->append(_major_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
207 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
208 |
add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
209 |
add_g1OldGen_memory_pool(g1h, _major_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
210 |
add_g1PermGen_memory_pool(g1h, _major_gc_manager); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
211 |
} |
1 | 212 |
#endif // SERIALGC |
213 |
||
214 |
MemoryPool* MemoryService::add_gen(Generation* gen, |
|
215 |
const char* name, |
|
216 |
bool is_heap, |
|
217 |
bool support_usage_threshold) { |
|
218 |
||
219 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
220 |
GenerationPool* pool = new GenerationPool(gen, name, type, support_usage_threshold); |
|
221 |
_pools_list->append(pool); |
|
222 |
return (MemoryPool*) pool; |
|
223 |
} |
|
224 |
||
225 |
MemoryPool* MemoryService::add_space(ContiguousSpace* space, |
|
226 |
const char* name, |
|
227 |
bool is_heap, |
|
228 |
size_t max_size, |
|
229 |
bool support_usage_threshold) { |
|
230 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
231 |
ContiguousSpacePool* pool = new ContiguousSpacePool(space, name, type, max_size, support_usage_threshold); |
|
232 |
||
233 |
_pools_list->append(pool); |
|
234 |
return (MemoryPool*) pool; |
|
235 |
} |
|
236 |
||
237 |
MemoryPool* MemoryService::add_survivor_spaces(DefNewGeneration* gen, |
|
238 |
const char* name, |
|
239 |
bool is_heap, |
|
240 |
size_t max_size, |
|
241 |
bool support_usage_threshold) { |
|
242 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
243 |
SurvivorContiguousSpacePool* pool = new SurvivorContiguousSpacePool(gen, name, type, max_size, support_usage_threshold); |
|
244 |
||
245 |
_pools_list->append(pool); |
|
246 |
return (MemoryPool*) pool; |
|
247 |
} |
|
248 |
||
249 |
#ifndef SERIALGC |
|
250 |
MemoryPool* MemoryService::add_cms_space(CompactibleFreeListSpace* space, |
|
251 |
const char* name, |
|
252 |
bool is_heap, |
|
253 |
size_t max_size, |
|
254 |
bool support_usage_threshold) { |
|
255 |
MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
|
256 |
CompactibleFreeListSpacePool* pool = new CompactibleFreeListSpacePool(space, name, type, max_size, support_usage_threshold); |
|
257 |
_pools_list->append(pool); |
|
258 |
return (MemoryPool*) pool; |
|
259 |
} |
|
260 |
#endif // SERIALGC |
|
261 |
||
262 |
// Add memory pool(s) for one generation |
|
263 |
void MemoryService::add_generation_memory_pool(Generation* gen, |
|
264 |
MemoryManager* major_mgr, |
|
265 |
MemoryManager* minor_mgr) { |
|
266 |
Generation::Name kind = gen->kind(); |
|
267 |
int index = _pools_list->length(); |
|
268 |
||
269 |
switch (kind) { |
|
270 |
case Generation::DefNew: { |
|
271 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
|
272 |
DefNewGeneration* young_gen = (DefNewGeneration*) gen; |
|
273 |
// Add a memory pool for each space and young gen doesn't |
|
274 |
// support low memory detection as it is expected to get filled up. |
|
275 |
MemoryPool* eden = add_space(young_gen->eden(), |
|
276 |
"Eden Space", |
|
277 |
true, /* is_heap */ |
|
278 |
young_gen->max_eden_size(), |
|
279 |
false /* support_usage_threshold */); |
|
280 |
MemoryPool* survivor = add_survivor_spaces(young_gen, |
|
281 |
"Survivor Space", |
|
282 |
true, /* is_heap */ |
|
283 |
young_gen->max_survivor_size(), |
|
284 |
false /* support_usage_threshold */); |
|
285 |
break; |
|
286 |
} |
|
287 |
||
288 |
#ifndef SERIALGC |
|
289 |
case Generation::ParNew: |
|
290 |
case Generation::ASParNew: |
|
291 |
{ |
|
292 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
|
293 |
// Add a memory pool for each space and young gen doesn't |
|
294 |
// support low memory detection as it is expected to get filled up. |
|
295 |
ParNewGeneration* parnew_gen = (ParNewGeneration*) gen; |
|
296 |
MemoryPool* eden = add_space(parnew_gen->eden(), |
|
297 |
"Par Eden Space", |
|
298 |
true /* is_heap */, |
|
299 |
parnew_gen->max_eden_size(), |
|
300 |
false /* support_usage_threshold */); |
|
301 |
MemoryPool* survivor = add_survivor_spaces(parnew_gen, |
|
302 |
"Par Survivor Space", |
|
303 |
true, /* is_heap */ |
|
304 |
parnew_gen->max_survivor_size(), |
|
305 |
false /* support_usage_threshold */); |
|
306 |
||
307 |
break; |
|
308 |
} |
|
309 |
#endif // SERIALGC |
|
310 |
||
311 |
case Generation::MarkSweepCompact: { |
|
312 |
assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); |
|
313 |
add_gen(gen, |
|
314 |
"Tenured Gen", |
|
315 |
true, /* is_heap */ |
|
316 |
true /* support_usage_threshold */); |
|
317 |
break; |
|
318 |
} |
|
319 |
||
320 |
#ifndef SERIALGC |
|
321 |
case Generation::ConcurrentMarkSweep: |
|
322 |
case Generation::ASConcurrentMarkSweep: |
|
323 |
{ |
|
324 |
assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); |
|
325 |
ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*) gen; |
|
326 |
MemoryPool* pool = add_cms_space(cms->cmsSpace(), |
|
327 |
"CMS Old Gen", |
|
328 |
true, /* is_heap */ |
|
329 |
cms->reserved().byte_size(), |
|
330 |
true /* support_usage_threshold */); |
|
331 |
break; |
|
332 |
} |
|
333 |
#endif // SERIALGC |
|
334 |
||
335 |
default: |
|
336 |
assert(false, "should not reach here"); |
|
337 |
// no memory pool added for others |
|
338 |
break; |
|
339 |
} |
|
340 |
||
341 |
assert(major_mgr != NULL, "Should have at least one manager"); |
|
342 |
// Link managers and the memory pools together |
|
343 |
for (int i = index; i < _pools_list->length(); i++) { |
|
344 |
MemoryPool* pool = _pools_list->at(i); |
|
345 |
major_mgr->add_pool(pool); |
|
346 |
if (minor_mgr != NULL) { |
|
347 |
minor_mgr->add_pool(pool); |
|
348 |
} |
|
349 |
} |
|
350 |
} |
|
351 |
||
352 |
void MemoryService::add_compact_perm_gen_memory_pool(CompactingPermGenGen* perm_gen, |
|
353 |
MemoryManager* mgr) { |
|
354 |
PermanentGenerationSpec* spec = perm_gen->spec(); |
|
355 |
size_t max_size = spec->max_size() - spec->read_only_size() - spec->read_write_size(); |
|
356 |
MemoryPool* pool = add_space(perm_gen->unshared_space(), |
|
357 |
"Perm Gen", |
|
358 |
false, /* is_heap */ |
|
359 |
max_size, |
|
360 |
true /* support_usage_threshold */); |
|
361 |
mgr->add_pool(pool); |
|
362 |
if (UseSharedSpaces) { |
|
363 |
pool = add_space(perm_gen->ro_space(), |
|
364 |
"Perm Gen [shared-ro]", |
|
365 |
false, /* is_heap */ |
|
366 |
spec->read_only_size(), |
|
367 |
true /* support_usage_threshold */); |
|
368 |
mgr->add_pool(pool); |
|
369 |
||
370 |
pool = add_space(perm_gen->rw_space(), |
|
371 |
"Perm Gen [shared-rw]", |
|
372 |
false, /* is_heap */ |
|
373 |
spec->read_write_size(), |
|
374 |
true /* support_usage_threshold */); |
|
375 |
mgr->add_pool(pool); |
|
376 |
} |
|
377 |
} |
|
378 |
||
379 |
#ifndef SERIALGC |
|
380 |
void MemoryService::add_cms_perm_gen_memory_pool(CMSPermGenGen* cms_gen, |
|
381 |
MemoryManager* mgr) { |
|
382 |
||
383 |
MemoryPool* pool = add_cms_space(cms_gen->cmsSpace(), |
|
384 |
"CMS Perm Gen", |
|
385 |
false, /* is_heap */ |
|
386 |
cms_gen->reserved().byte_size(), |
|
387 |
true /* support_usage_threshold */); |
|
388 |
mgr->add_pool(pool); |
|
389 |
} |
|
390 |
||
391 |
void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) { |
|
392 |
assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
|
393 |
||
394 |
// Add a memory pool for each space and young gen doesn't |
|
395 |
// support low memory detection as it is expected to get filled up. |
|
396 |
EdenMutableSpacePool* eden = new EdenMutableSpacePool(gen, |
|
397 |
gen->eden_space(), |
|
398 |
"PS Eden Space", |
|
399 |
MemoryPool::Heap, |
|
400 |
false /* support_usage_threshold */); |
|
401 |
||
402 |
SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(gen, |
|
403 |
"PS Survivor Space", |
|
404 |
MemoryPool::Heap, |
|
405 |
false /* support_usage_threshold */); |
|
406 |
||
407 |
major_mgr->add_pool(eden); |
|
408 |
major_mgr->add_pool(survivor); |
|
409 |
minor_mgr->add_pool(eden); |
|
410 |
minor_mgr->add_pool(survivor); |
|
411 |
_pools_list->append(eden); |
|
412 |
_pools_list->append(survivor); |
|
413 |
} |
|
414 |
||
415 |
void MemoryService::add_psOld_memory_pool(PSOldGen* gen, MemoryManager* mgr) { |
|
416 |
PSGenerationPool* old_gen = new PSGenerationPool(gen, |
|
417 |
"PS Old Gen", |
|
418 |
MemoryPool::Heap, |
|
419 |
true /* support_usage_threshold */); |
|
420 |
mgr->add_pool(old_gen); |
|
421 |
_pools_list->append(old_gen); |
|
422 |
} |
|
423 |
||
424 |
void MemoryService::add_psPerm_memory_pool(PSPermGen* gen, MemoryManager* mgr) { |
|
425 |
PSGenerationPool* perm_gen = new PSGenerationPool(gen, |
|
426 |
"PS Perm Gen", |
|
427 |
MemoryPool::NonHeap, |
|
428 |
true /* support_usage_threshold */); |
|
429 |
mgr->add_pool(perm_gen); |
|
430 |
_pools_list->append(perm_gen); |
|
431 |
} |
|
4459
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
432 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
433 |
void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
434 |
MemoryManager* major_mgr, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
435 |
MemoryManager* minor_mgr) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
436 |
assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
437 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
438 |
G1EdenPool* eden = new G1EdenPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
439 |
G1SurvivorPool* survivor = new G1SurvivorPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
440 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
441 |
major_mgr->add_pool(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
442 |
major_mgr->add_pool(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
443 |
minor_mgr->add_pool(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
444 |
minor_mgr->add_pool(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
445 |
_pools_list->append(eden); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
446 |
_pools_list->append(survivor); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
447 |
} |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
448 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
449 |
void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
450 |
MemoryManager* mgr) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
451 |
assert(mgr != NULL, "should have one manager"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
452 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
453 |
G1OldGenPool* old_gen = new G1OldGenPool(g1h); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
454 |
mgr->add_pool(old_gen); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
455 |
_pools_list->append(old_gen); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
456 |
} |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
457 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
458 |
void MemoryService::add_g1PermGen_memory_pool(G1CollectedHeap* g1h, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
459 |
MemoryManager* mgr) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
460 |
assert(mgr != NULL, "should have one manager"); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
461 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
462 |
CompactingPermGenGen* perm_gen = (CompactingPermGenGen*) g1h->perm_gen(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
463 |
PermanentGenerationSpec* spec = perm_gen->spec(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
464 |
size_t max_size = spec->max_size() - spec->read_only_size() |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
465 |
- spec->read_write_size(); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
466 |
MemoryPool* pool = add_space(perm_gen->unshared_space(), |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
467 |
"G1 Perm Gen", |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
468 |
false, /* is_heap */ |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
469 |
max_size, |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
470 |
true /* support_usage_threshold */); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
471 |
mgr->add_pool(pool); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
472 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
473 |
// in case we support CDS in G1 |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
474 |
if (UseSharedSpaces) { |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
475 |
pool = add_space(perm_gen->ro_space(), |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
476 |
"G1 Perm Gen [shared-ro]", |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
477 |
false, /* is_heap */ |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
478 |
spec->read_only_size(), |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
479 |
true /* support_usage_threshold */); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
480 |
mgr->add_pool(pool); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
481 |
|
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
482 |
pool = add_space(perm_gen->rw_space(), |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
483 |
"G1 Perm Gen [shared-rw]", |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
484 |
false, /* is_heap */ |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
485 |
spec->read_write_size(), |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
486 |
true /* support_usage_threshold */); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
487 |
mgr->add_pool(pool); |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
488 |
} |
eb506d590394
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
1374
diff
changeset
|
489 |
} |
1 | 490 |
#endif // SERIALGC |
491 |
||
492 |
void MemoryService::add_code_heap_memory_pool(CodeHeap* heap) { |
|
493 |
_code_heap_pool = new CodeHeapPool(heap, |
|
494 |
"Code Cache", |
|
495 |
true /* support_usage_threshold */); |
|
496 |
MemoryManager* mgr = MemoryManager::get_code_cache_memory_manager(); |
|
497 |
mgr->add_pool(_code_heap_pool); |
|
498 |
||
499 |
_pools_list->append(_code_heap_pool); |
|
500 |
_managers_list->append(mgr); |
|
501 |
} |
|
502 |
||
503 |
MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) { |
|
504 |
for (int i = 0; i < _managers_list->length(); i++) { |
|
505 |
MemoryManager* mgr = _managers_list->at(i); |
|
506 |
if (mgr->is_manager(mh)) { |
|
507 |
return mgr; |
|
508 |
} |
|
509 |
} |
|
510 |
return NULL; |
|
511 |
} |
|
512 |
||
513 |
MemoryPool* MemoryService::get_memory_pool(instanceHandle ph) { |
|
514 |
for (int i = 0; i < _pools_list->length(); i++) { |
|
515 |
MemoryPool* pool = _pools_list->at(i); |
|
516 |
if (pool->is_pool(ph)) { |
|
517 |
return pool; |
|
518 |
} |
|
519 |
} |
|
520 |
return NULL; |
|
521 |
} |
|
522 |
||
523 |
void MemoryService::track_memory_usage() { |
|
524 |
// Track the peak memory usage |
|
525 |
for (int i = 0; i < _pools_list->length(); i++) { |
|
526 |
MemoryPool* pool = _pools_list->at(i); |
|
527 |
pool->record_peak_memory_usage(); |
|
528 |
} |
|
529 |
||
530 |
// Detect low memory |
|
531 |
LowMemoryDetector::detect_low_memory(); |
|
532 |
} |
|
533 |
||
534 |
void MemoryService::track_memory_pool_usage(MemoryPool* pool) { |
|
535 |
// Track the peak memory usage |
|
536 |
pool->record_peak_memory_usage(); |
|
537 |
||
538 |
// Detect low memory |
|
539 |
if (LowMemoryDetector::is_enabled(pool)) { |
|
540 |
LowMemoryDetector::detect_low_memory(pool); |
|
541 |
} |
|
542 |
} |
|
543 |
||
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
544 |
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
|
545 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
546 |
bool recordPreGCUsage, bool recordPeakUsage) { |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
547 |
|
1 | 548 |
GCMemoryManager* mgr; |
549 |
if (fullGC) { |
|
550 |
mgr = _major_gc_manager; |
|
551 |
} else { |
|
552 |
mgr = _minor_gc_manager; |
|
553 |
} |
|
554 |
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
|
555 |
mgr->gc_begin(recordGCBeginTime, recordPreGCUsage, recordAccumulatedGCTime); |
1 | 556 |
|
557 |
// 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
|
558 |
if (recordPeakUsage) { |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
559 |
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
|
560 |
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
|
561 |
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
|
562 |
} |
1 | 563 |
} |
564 |
} |
|
565 |
||
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
566 |
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
|
567 |
bool recordAccumulatedGCTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
568 |
bool recordGCEndTime, bool countCollection, |
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
569 |
GCCause::Cause cause) { |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
570 |
|
1 | 571 |
GCMemoryManager* mgr; |
572 |
if (fullGC) { |
|
573 |
mgr = (GCMemoryManager*) _major_gc_manager; |
|
574 |
} else { |
|
575 |
mgr = (GCMemoryManager*) _minor_gc_manager; |
|
576 |
} |
|
577 |
assert(mgr->is_gc_memory_manager(), "Sanity check"); |
|
578 |
||
579 |
// 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
|
580 |
mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
581 |
countCollection, cause); |
1 | 582 |
} |
583 |
||
584 |
void MemoryService::oops_do(OopClosure* f) { |
|
585 |
int i; |
|
586 |
||
587 |
for (i = 0; i < _pools_list->length(); i++) { |
|
588 |
MemoryPool* pool = _pools_list->at(i); |
|
589 |
pool->oops_do(f); |
|
590 |
} |
|
591 |
for (i = 0; i < _managers_list->length(); i++) { |
|
592 |
MemoryManager* mgr = _managers_list->at(i); |
|
593 |
mgr->oops_do(f); |
|
594 |
} |
|
595 |
} |
|
596 |
||
597 |
bool MemoryService::set_verbose(bool verbose) { |
|
598 |
MutexLocker m(Management_lock); |
|
599 |
// verbose will be set to the previous value |
|
600 |
bool succeed = CommandLineFlags::boolAtPut((char*)"PrintGC", &verbose, MANAGEMENT); |
|
601 |
assert(succeed, "Setting PrintGC flag fails"); |
|
602 |
ClassLoadingService::reset_trace_class_unloading(); |
|
603 |
||
604 |
return verbose; |
|
605 |
} |
|
606 |
||
607 |
Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) { |
|
608 |
klassOop k = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); |
|
609 |
instanceKlassHandle ik(THREAD, k); |
|
610 |
||
611 |
instanceHandle obj = ik->allocate_instance_handle(CHECK_NH); |
|
612 |
||
613 |
JavaValue result(T_VOID); |
|
614 |
JavaCallArguments args(10); |
|
615 |
args.push_oop(obj); // receiver |
|
616 |
args.push_long(usage.init_size_as_jlong()); // Argument 1 |
|
617 |
args.push_long(usage.used_as_jlong()); // Argument 2 |
|
618 |
args.push_long(usage.committed_as_jlong()); // Argument 3 |
|
619 |
args.push_long(usage.max_size_as_jlong()); // Argument 4 |
|
620 |
||
621 |
JavaCalls::call_special(&result, |
|
622 |
ik, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
623 |
vmSymbols::object_initializer_name(), |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
624 |
vmSymbols::long_long_long_long_void_signature(), |
1 | 625 |
&args, |
626 |
CHECK_NH); |
|
627 |
return obj; |
|
628 |
} |
|
629 |
// |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
630 |
// GC manager type depends on the type of Generation. Depending on the space |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
631 |
// availablity and vm options the gc uses major gc manager or minor gc |
1 | 632 |
// manager or both. The type of gc manager depends on the generation kind. |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
633 |
// For DefNew, ParNew and ASParNew generation doing scavenge gc uses minor |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
634 |
// gc manager (so _fullGC is set to false ) and for other generation kinds |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
635 |
// doing mark-sweep-compact uses major gc manager (so _fullGC is set |
1 | 636 |
// to true). |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
637 |
TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) { |
1 | 638 |
switch (kind) { |
639 |
case Generation::DefNew: |
|
640 |
#ifndef SERIALGC |
|
641 |
case Generation::ParNew: |
|
642 |
case Generation::ASParNew: |
|
643 |
#endif // SERIALGC |
|
644 |
_fullGC=false; |
|
645 |
break; |
|
646 |
case Generation::MarkSweepCompact: |
|
647 |
#ifndef SERIALGC |
|
648 |
case Generation::ConcurrentMarkSweep: |
|
649 |
case Generation::ASConcurrentMarkSweep: |
|
650 |
#endif // SERIALGC |
|
651 |
_fullGC=true; |
|
652 |
break; |
|
653 |
default: |
|
654 |
assert(false, "Unrecognized gc generation kind."); |
|
655 |
} |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
656 |
// 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
|
657 |
// an entire gc pause, start to finish: |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
658 |
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
|
659 |
} |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
660 |
TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
661 |
GCCause::Cause cause, |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
662 |
bool recordGCBeginTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
663 |
bool recordPreGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
664 |
bool recordPeakUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
665 |
bool recordPostGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
666 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
667 |
bool recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
668 |
bool countCollection) { |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
669 |
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
|
670 |
recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
671 |
countCollection); |
1 | 672 |
} |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
673 |
|
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
674 |
// 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
|
675 |
// the MemoryService |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
676 |
void TraceMemoryManagerStats::initialize(bool fullGC, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
677 |
GCCause::Cause cause, |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
678 |
bool recordGCBeginTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
679 |
bool recordPreGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
680 |
bool recordPeakUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
681 |
bool recordPostGCUsage, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
682 |
bool recordAccumulatedGCTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
683 |
bool recordGCEndTime, |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
684 |
bool countCollection) { |
1 | 685 |
_fullGC = fullGC; |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
686 |
_recordGCBeginTime = recordGCBeginTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
687 |
_recordPreGCUsage = recordPreGCUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
688 |
_recordPeakUsage = recordPeakUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
689 |
_recordPostGCUsage = recordPostGCUsage; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
690 |
_recordAccumulatedGCTime = recordAccumulatedGCTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
691 |
_recordGCEndTime = recordGCEndTime; |
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
692 |
_countCollection = countCollection; |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
693 |
_cause = cause; |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
694 |
|
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
695 |
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
|
696 |
_recordPreGCUsage, _recordPeakUsage); |
1 | 697 |
} |
698 |
||
699 |
TraceMemoryManagerStats::~TraceMemoryManagerStats() { |
|
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
700 |
MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime, |
9623
151c0b638488
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
8921
diff
changeset
|
701 |
_recordGCEndTime, _countCollection, _cause); |
1 | 702 |
} |
6245
c37d2cf6de1a
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
5547
diff
changeset
|
703 |