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