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