annotate src/share/vm/services/memoryService.cpp @ 17467:55fb97c4c58d hs25-b65

8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013 Summary: Copyright year updated for files modified during 2013 Reviewed-by: twisti, iveresov
author mikael
date Tue, 24 Dec 2013 11:48:39 -0800
parents 72b7e96c1922
children 4ca6dc0799b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17467
55fb97c4c58d 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 12322
diff changeset
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1089
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1089
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1089
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
26 #include "classfile/systemDictionary.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
27 #include "classfile/vmSymbols.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
28 #include "gc_implementation/shared/mutableSpace.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
29 #include "memory/collectorPolicy.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
30 #include "memory/defNewGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
31 #include "memory/genCollectedHeap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
32 #include "memory/generation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
33 #include "memory/generationSpec.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
34 #include "memory/heap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
35 #include "memory/memRegion.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
36 #include "memory/tenuredGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
37 #include "oops/oop.inline.hpp"
11039
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
38 #include "runtime/globals.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
39 #include "runtime/javaCalls.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
40 #include "services/classLoadingService.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
41 #include "services/lowMemoryDetector.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
42 #include "services/management.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
43 #include "services/memoryManager.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
44 #include "services/memoryPool.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
45 #include "services/memoryService.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
46 #include "utilities/growableArray.hpp"
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
47 #include "utilities/macros.hpp"
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
48 #if INCLUDE_ALL_GCS
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
49 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
50 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
51 #include "gc_implementation/parNew/parNewGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
52 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
53 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
54 #include "gc_implementation/parallelScavenge/psYoungGen.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
55 #include "services/g1MemoryPool.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1703
diff changeset
56 #include "services/psMemoryPool.hpp"
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
57 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 GrowableArray<MemoryPool*>* MemoryService::_pools_list =
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 3356
diff changeset
60 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_pools_list_size, true);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61 GrowableArray<MemoryManager*>* MemoryService::_managers_list =
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 3356
diff changeset
62 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryManager*>(init_managers_list_size, true);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
63
11039
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
64 GCMemoryManager* MemoryService::_minor_gc_manager = NULL;
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
65 GCMemoryManager* MemoryService::_major_gc_manager = NULL;
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
66 MemoryPool* MemoryService::_code_heap_pool = NULL;
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
67 MemoryPool* MemoryService::_metaspace_pool = NULL;
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
68 MemoryPool* MemoryService::_compressed_class_pool = NULL;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 class GcThreadCountClosure: public ThreadClosure {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
72 int _count;
a61af66fc99e Initial load
duke
parents:
diff changeset
73 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
74 GcThreadCountClosure() : _count(0) {};
a61af66fc99e Initial load
duke
parents:
diff changeset
75 void do_thread(Thread* thread);
a61af66fc99e Initial load
duke
parents:
diff changeset
76 int count() { return _count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
77 };
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 void GcThreadCountClosure::do_thread(Thread* thread) {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 _count++;
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 void MemoryService::set_universe_heap(CollectedHeap* heap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 CollectedHeap::Name kind = heap->kind();
a61af66fc99e Initial load
duke
parents:
diff changeset
85 switch (kind) {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 case CollectedHeap::GenCollectedHeap : {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 add_gen_collected_heap_info(GenCollectedHeap::heap());
a61af66fc99e Initial load
duke
parents:
diff changeset
88 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
90 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
91 case CollectedHeap::ParallelScavengeHeap : {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap());
a61af66fc99e Initial load
duke
parents:
diff changeset
93 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
95 case CollectedHeap::G1CollectedHeap : {
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
96 add_g1_heap_info(G1CollectedHeap::heap());
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
97 break;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
98 }
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
99 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
100 default: {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
101 guarantee(false, "Unrecognized kind of heap");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // set the GC thread count
a61af66fc99e Initial load
duke
parents:
diff changeset
106 GcThreadCountClosure gctcc;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 heap->gc_threads_do(&gctcc);
a61af66fc99e Initial load
duke
parents:
diff changeset
108 int count = gctcc.count();
a61af66fc99e Initial load
duke
parents:
diff changeset
109 if (count > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
110 _minor_gc_manager->set_num_gc_threads(count);
a61af66fc99e Initial load
duke
parents:
diff changeset
111 _major_gc_manager->set_num_gc_threads(count);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // All memory pools and memory managers are initialized.
a61af66fc99e Initial load
duke
parents:
diff changeset
115 //
a61af66fc99e Initial load
duke
parents:
diff changeset
116 _minor_gc_manager->initialize_gc_stat_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
117 _major_gc_manager->initialize_gc_stat_info();
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // Add memory pools for GenCollectedHeap
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // This function currently only supports two generations collected heap.
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // The collector for GenCollectedHeap will have two memory managers.
a61af66fc99e Initial load
duke
parents:
diff changeset
123 void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
124 CollectorPolicy* policy = heap->collector_policy();
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 assert(policy->is_two_generation_policy(), "Only support two generations");
a61af66fc99e Initial load
duke
parents:
diff changeset
127 guarantee(heap->n_gens() == 2, "Only support two-generation heap");
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 TwoGenerationCollectorPolicy* two_gen_policy = policy->as_two_generation_policy();
a61af66fc99e Initial load
duke
parents:
diff changeset
130 if (two_gen_policy != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 GenerationSpec** specs = two_gen_policy->generations();
a61af66fc99e Initial load
duke
parents:
diff changeset
132 Generation::Name kind = specs[0]->name();
a61af66fc99e Initial load
duke
parents:
diff changeset
133 switch (kind) {
a61af66fc99e Initial load
duke
parents:
diff changeset
134 case Generation::DefNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
135 _minor_gc_manager = MemoryManager::get_copy_memory_manager();
a61af66fc99e Initial load
duke
parents:
diff changeset
136 break;
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
137 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
138 case Generation::ParNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
139 case Generation::ASParNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
140 _minor_gc_manager = MemoryManager::get_parnew_memory_manager();
a61af66fc99e Initial load
duke
parents:
diff changeset
141 break;
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
142 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
143 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
144 guarantee(false, "Unrecognized generation spec");
a61af66fc99e Initial load
duke
parents:
diff changeset
145 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
147 if (policy->is_mark_sweep_policy()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
148 _major_gc_manager = MemoryManager::get_msc_memory_manager();
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
149 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
150 } else if (policy->is_concurrent_mark_sweep_policy()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
151 _major_gc_manager = MemoryManager::get_cms_memory_manager();
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
152 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
153 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
154 guarantee(false, "Unknown two-gen policy");
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
157 guarantee(false, "Non two-gen policy");
a61af66fc99e Initial load
duke
parents:
diff changeset
158 }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 _managers_list->append(_minor_gc_manager);
a61af66fc99e Initial load
duke
parents:
diff changeset
160 _managers_list->append(_major_gc_manager);
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 add_generation_memory_pool(heap->get_gen(minor), _major_gc_manager, _minor_gc_manager);
a61af66fc99e Initial load
duke
parents:
diff changeset
163 add_generation_memory_pool(heap->get_gen(major), _major_gc_manager);
a61af66fc99e Initial load
duke
parents:
diff changeset
164 }
a61af66fc99e Initial load
duke
parents:
diff changeset
165
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
166 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
167 // Add memory pools for ParallelScavengeHeap
a61af66fc99e Initial load
duke
parents:
diff changeset
168 // This function currently only supports two generations collected heap.
a61af66fc99e Initial load
duke
parents:
diff changeset
169 // The collector for ParallelScavengeHeap will have two memory managers.
a61af66fc99e Initial load
duke
parents:
diff changeset
170 void MemoryService::add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 // Two managers to keep statistics about _minor_gc_manager and _major_gc_manager GC.
a61af66fc99e Initial load
duke
parents:
diff changeset
172 _minor_gc_manager = MemoryManager::get_psScavenge_memory_manager();
a61af66fc99e Initial load
duke
parents:
diff changeset
173 _major_gc_manager = MemoryManager::get_psMarkSweep_memory_manager();
a61af66fc99e Initial load
duke
parents:
diff changeset
174 _managers_list->append(_minor_gc_manager);
a61af66fc99e Initial load
duke
parents:
diff changeset
175 _managers_list->append(_major_gc_manager);
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 add_psYoung_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager);
a61af66fc99e Initial load
duke
parents:
diff changeset
178 add_psOld_memory_pool(heap->old_gen(), _major_gc_manager);
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
180
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
181 void MemoryService::add_g1_heap_info(G1CollectedHeap* g1h) {
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
182 assert(UseG1GC, "sanity");
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
183
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
184 _minor_gc_manager = MemoryManager::get_g1YoungGen_memory_manager();
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
185 _major_gc_manager = MemoryManager::get_g1OldGen_memory_manager();
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
186 _managers_list->append(_minor_gc_manager);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
187 _managers_list->append(_major_gc_manager);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
188
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
189 add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
190 add_g1OldGen_memory_pool(g1h, _major_gc_manager);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
191 }
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
192 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
193
a61af66fc99e Initial load
duke
parents:
diff changeset
194 MemoryPool* MemoryService::add_gen(Generation* gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
195 const char* name,
a61af66fc99e Initial load
duke
parents:
diff changeset
196 bool is_heap,
a61af66fc99e Initial load
duke
parents:
diff changeset
197 bool support_usage_threshold) {
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap);
a61af66fc99e Initial load
duke
parents:
diff changeset
200 GenerationPool* pool = new GenerationPool(gen, name, type, support_usage_threshold);
a61af66fc99e Initial load
duke
parents:
diff changeset
201 _pools_list->append(pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
202 return (MemoryPool*) pool;
a61af66fc99e Initial load
duke
parents:
diff changeset
203 }
a61af66fc99e Initial load
duke
parents:
diff changeset
204
a61af66fc99e Initial load
duke
parents:
diff changeset
205 MemoryPool* MemoryService::add_space(ContiguousSpace* space,
a61af66fc99e Initial load
duke
parents:
diff changeset
206 const char* name,
a61af66fc99e Initial load
duke
parents:
diff changeset
207 bool is_heap,
a61af66fc99e Initial load
duke
parents:
diff changeset
208 size_t max_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
209 bool support_usage_threshold) {
a61af66fc99e Initial load
duke
parents:
diff changeset
210 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap);
a61af66fc99e Initial load
duke
parents:
diff changeset
211 ContiguousSpacePool* pool = new ContiguousSpacePool(space, name, type, max_size, support_usage_threshold);
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 _pools_list->append(pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
214 return (MemoryPool*) pool;
a61af66fc99e Initial load
duke
parents:
diff changeset
215 }
a61af66fc99e Initial load
duke
parents:
diff changeset
216
a61af66fc99e Initial load
duke
parents:
diff changeset
217 MemoryPool* MemoryService::add_survivor_spaces(DefNewGeneration* gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
218 const char* name,
a61af66fc99e Initial load
duke
parents:
diff changeset
219 bool is_heap,
a61af66fc99e Initial load
duke
parents:
diff changeset
220 size_t max_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
221 bool support_usage_threshold) {
a61af66fc99e Initial load
duke
parents:
diff changeset
222 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap);
a61af66fc99e Initial load
duke
parents:
diff changeset
223 SurvivorContiguousSpacePool* pool = new SurvivorContiguousSpacePool(gen, name, type, max_size, support_usage_threshold);
a61af66fc99e Initial load
duke
parents:
diff changeset
224
a61af66fc99e Initial load
duke
parents:
diff changeset
225 _pools_list->append(pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
226 return (MemoryPool*) pool;
a61af66fc99e Initial load
duke
parents:
diff changeset
227 }
a61af66fc99e Initial load
duke
parents:
diff changeset
228
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
229 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
230 MemoryPool* MemoryService::add_cms_space(CompactibleFreeListSpace* space,
a61af66fc99e Initial load
duke
parents:
diff changeset
231 const char* name,
a61af66fc99e Initial load
duke
parents:
diff changeset
232 bool is_heap,
a61af66fc99e Initial load
duke
parents:
diff changeset
233 size_t max_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
234 bool support_usage_threshold) {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap);
a61af66fc99e Initial load
duke
parents:
diff changeset
236 CompactibleFreeListSpacePool* pool = new CompactibleFreeListSpacePool(space, name, type, max_size, support_usage_threshold);
a61af66fc99e Initial load
duke
parents:
diff changeset
237 _pools_list->append(pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
238 return (MemoryPool*) pool;
a61af66fc99e Initial load
duke
parents:
diff changeset
239 }
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
240 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
241
a61af66fc99e Initial load
duke
parents:
diff changeset
242 // Add memory pool(s) for one generation
a61af66fc99e Initial load
duke
parents:
diff changeset
243 void MemoryService::add_generation_memory_pool(Generation* gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
244 MemoryManager* major_mgr,
a61af66fc99e Initial load
duke
parents:
diff changeset
245 MemoryManager* minor_mgr) {
8761
8b4ce9870fd6 8009156: [parfait] Null pointer deference in hotspot/src/share/vm/services/memoryService.cpp
morris
parents: 8001
diff changeset
246 guarantee(gen != NULL, "No generation for memory pool");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
247 Generation::Name kind = gen->kind();
a61af66fc99e Initial load
duke
parents:
diff changeset
248 int index = _pools_list->length();
a61af66fc99e Initial load
duke
parents:
diff changeset
249
a61af66fc99e Initial load
duke
parents:
diff changeset
250 switch (kind) {
a61af66fc99e Initial load
duke
parents:
diff changeset
251 case Generation::DefNew: {
a61af66fc99e Initial load
duke
parents:
diff changeset
252 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers");
a61af66fc99e Initial load
duke
parents:
diff changeset
253 DefNewGeneration* young_gen = (DefNewGeneration*) gen;
a61af66fc99e Initial load
duke
parents:
diff changeset
254 // Add a memory pool for each space and young gen doesn't
a61af66fc99e Initial load
duke
parents:
diff changeset
255 // support low memory detection as it is expected to get filled up.
a61af66fc99e Initial load
duke
parents:
diff changeset
256 MemoryPool* eden = add_space(young_gen->eden(),
a61af66fc99e Initial load
duke
parents:
diff changeset
257 "Eden Space",
a61af66fc99e Initial load
duke
parents:
diff changeset
258 true, /* is_heap */
a61af66fc99e Initial load
duke
parents:
diff changeset
259 young_gen->max_eden_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
260 false /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
261 MemoryPool* survivor = add_survivor_spaces(young_gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
262 "Survivor Space",
a61af66fc99e Initial load
duke
parents:
diff changeset
263 true, /* is_heap */
a61af66fc99e Initial load
duke
parents:
diff changeset
264 young_gen->max_survivor_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
265 false /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
266 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
267 }
a61af66fc99e Initial load
duke
parents:
diff changeset
268
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
269 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
270 case Generation::ParNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
271 case Generation::ASParNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
272 {
a61af66fc99e Initial load
duke
parents:
diff changeset
273 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers");
a61af66fc99e Initial load
duke
parents:
diff changeset
274 // Add a memory pool for each space and young gen doesn't
a61af66fc99e Initial load
duke
parents:
diff changeset
275 // support low memory detection as it is expected to get filled up.
a61af66fc99e Initial load
duke
parents:
diff changeset
276 ParNewGeneration* parnew_gen = (ParNewGeneration*) gen;
a61af66fc99e Initial load
duke
parents:
diff changeset
277 MemoryPool* eden = add_space(parnew_gen->eden(),
a61af66fc99e Initial load
duke
parents:
diff changeset
278 "Par Eden Space",
a61af66fc99e Initial load
duke
parents:
diff changeset
279 true /* is_heap */,
a61af66fc99e Initial load
duke
parents:
diff changeset
280 parnew_gen->max_eden_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
281 false /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
282 MemoryPool* survivor = add_survivor_spaces(parnew_gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
283 "Par Survivor Space",
a61af66fc99e Initial load
duke
parents:
diff changeset
284 true, /* is_heap */
a61af66fc99e Initial load
duke
parents:
diff changeset
285 parnew_gen->max_survivor_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
286 false /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
287
a61af66fc99e Initial load
duke
parents:
diff changeset
288 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
289 }
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
290 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
291
a61af66fc99e Initial load
duke
parents:
diff changeset
292 case Generation::MarkSweepCompact: {
a61af66fc99e Initial load
duke
parents:
diff changeset
293 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager");
a61af66fc99e Initial load
duke
parents:
diff changeset
294 add_gen(gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
295 "Tenured Gen",
a61af66fc99e Initial load
duke
parents:
diff changeset
296 true, /* is_heap */
a61af66fc99e Initial load
duke
parents:
diff changeset
297 true /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
298 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
299 }
a61af66fc99e Initial load
duke
parents:
diff changeset
300
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
301 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
302 case Generation::ConcurrentMarkSweep:
a61af66fc99e Initial load
duke
parents:
diff changeset
303 case Generation::ASConcurrentMarkSweep:
a61af66fc99e Initial load
duke
parents:
diff changeset
304 {
a61af66fc99e Initial load
duke
parents:
diff changeset
305 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager");
a61af66fc99e Initial load
duke
parents:
diff changeset
306 ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*) gen;
a61af66fc99e Initial load
duke
parents:
diff changeset
307 MemoryPool* pool = add_cms_space(cms->cmsSpace(),
a61af66fc99e Initial load
duke
parents:
diff changeset
308 "CMS Old Gen",
a61af66fc99e Initial load
duke
parents:
diff changeset
309 true, /* is_heap */
a61af66fc99e Initial load
duke
parents:
diff changeset
310 cms->reserved().byte_size(),
a61af66fc99e Initial load
duke
parents:
diff changeset
311 true /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
312 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
313 }
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
314 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
315
a61af66fc99e Initial load
duke
parents:
diff changeset
316 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
317 assert(false, "should not reach here");
a61af66fc99e Initial load
duke
parents:
diff changeset
318 // no memory pool added for others
a61af66fc99e Initial load
duke
parents:
diff changeset
319 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
320 }
a61af66fc99e Initial load
duke
parents:
diff changeset
321
a61af66fc99e Initial load
duke
parents:
diff changeset
322 assert(major_mgr != NULL, "Should have at least one manager");
a61af66fc99e Initial load
duke
parents:
diff changeset
323 // Link managers and the memory pools together
a61af66fc99e Initial load
duke
parents:
diff changeset
324 for (int i = index; i < _pools_list->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
325 MemoryPool* pool = _pools_list->at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
326 major_mgr->add_pool(pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
327 if (minor_mgr != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
328 minor_mgr->add_pool(pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
329 }
a61af66fc99e Initial load
duke
parents:
diff changeset
330 }
a61af66fc99e Initial load
duke
parents:
diff changeset
331 }
a61af66fc99e Initial load
duke
parents:
diff changeset
332
a61af66fc99e Initial load
duke
parents:
diff changeset
333
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
334 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
335 void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
336 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers");
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338 // Add a memory pool for each space and young gen doesn't
a61af66fc99e Initial load
duke
parents:
diff changeset
339 // support low memory detection as it is expected to get filled up.
a61af66fc99e Initial load
duke
parents:
diff changeset
340 EdenMutableSpacePool* eden = new EdenMutableSpacePool(gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
341 gen->eden_space(),
a61af66fc99e Initial load
duke
parents:
diff changeset
342 "PS Eden Space",
a61af66fc99e Initial load
duke
parents:
diff changeset
343 MemoryPool::Heap,
a61af66fc99e Initial load
duke
parents:
diff changeset
344 false /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
345
a61af66fc99e Initial load
duke
parents:
diff changeset
346 SurvivorMutableSpacePool* survivor = new SurvivorMutableSpacePool(gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
347 "PS Survivor Space",
a61af66fc99e Initial load
duke
parents:
diff changeset
348 MemoryPool::Heap,
a61af66fc99e Initial load
duke
parents:
diff changeset
349 false /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
350
a61af66fc99e Initial load
duke
parents:
diff changeset
351 major_mgr->add_pool(eden);
a61af66fc99e Initial load
duke
parents:
diff changeset
352 major_mgr->add_pool(survivor);
a61af66fc99e Initial load
duke
parents:
diff changeset
353 minor_mgr->add_pool(eden);
a61af66fc99e Initial load
duke
parents:
diff changeset
354 minor_mgr->add_pool(survivor);
a61af66fc99e Initial load
duke
parents:
diff changeset
355 _pools_list->append(eden);
a61af66fc99e Initial load
duke
parents:
diff changeset
356 _pools_list->append(survivor);
a61af66fc99e Initial load
duke
parents:
diff changeset
357 }
a61af66fc99e Initial load
duke
parents:
diff changeset
358
a61af66fc99e Initial load
duke
parents:
diff changeset
359 void MemoryService::add_psOld_memory_pool(PSOldGen* gen, MemoryManager* mgr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
360 PSGenerationPool* old_gen = new PSGenerationPool(gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
361 "PS Old Gen",
a61af66fc99e Initial load
duke
parents:
diff changeset
362 MemoryPool::Heap,
a61af66fc99e Initial load
duke
parents:
diff changeset
363 true /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
364 mgr->add_pool(old_gen);
a61af66fc99e Initial load
duke
parents:
diff changeset
365 _pools_list->append(old_gen);
a61af66fc99e Initial load
duke
parents:
diff changeset
366 }
a61af66fc99e Initial load
duke
parents:
diff changeset
367
1089
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
368 void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
369 MemoryManager* major_mgr,
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
370 MemoryManager* minor_mgr) {
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
371 assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers");
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
372
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
373 G1EdenPool* eden = new G1EdenPool(g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
374 G1SurvivorPool* survivor = new G1SurvivorPool(g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
375
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
376 major_mgr->add_pool(eden);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
377 major_mgr->add_pool(survivor);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
378 minor_mgr->add_pool(eden);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
379 minor_mgr->add_pool(survivor);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
380 _pools_list->append(eden);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
381 _pools_list->append(survivor);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
382 }
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
383
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
384 void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
385 MemoryManager* mgr) {
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
386 assert(mgr != NULL, "should have one manager");
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
387
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
388 G1OldGenPool* old_gen = new G1OldGenPool(g1h);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
389 mgr->add_pool(old_gen);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
390 _pools_list->append(old_gen);
db0d5eba9d20 6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents: 342
diff changeset
391 }
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
392 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
393
a61af66fc99e Initial load
duke
parents:
diff changeset
394 void MemoryService::add_code_heap_memory_pool(CodeHeap* heap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
395 _code_heap_pool = new CodeHeapPool(heap,
a61af66fc99e Initial load
duke
parents:
diff changeset
396 "Code Cache",
a61af66fc99e Initial load
duke
parents:
diff changeset
397 true /* support_usage_threshold */);
a61af66fc99e Initial load
duke
parents:
diff changeset
398 MemoryManager* mgr = MemoryManager::get_code_cache_memory_manager();
a61af66fc99e Initial load
duke
parents:
diff changeset
399 mgr->add_pool(_code_heap_pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
400
a61af66fc99e Initial load
duke
parents:
diff changeset
401 _pools_list->append(_code_heap_pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
402 _managers_list->append(mgr);
a61af66fc99e Initial load
duke
parents:
diff changeset
403 }
a61af66fc99e Initial load
duke
parents:
diff changeset
404
11039
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
405 void MemoryService::add_metaspace_memory_pools() {
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
406 MemoryManager* mgr = MemoryManager::get_metaspace_memory_manager();
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
407
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
408 _metaspace_pool = new MetaspacePool();
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
409 mgr->add_pool(_metaspace_pool);
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
410 _pools_list->append(_metaspace_pool);
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
411
12226
7944aba7ba41 8015107: NPG: Use consistent naming for metaspace concepts
ehelin
parents: 11039
diff changeset
412 if (UseCompressedClassPointers) {
11039
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
413 _compressed_class_pool = new CompressedKlassSpacePool();
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
414 mgr->add_pool(_compressed_class_pool);
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
415 _pools_list->append(_compressed_class_pool);
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
416 }
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
417
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
418 _managers_list->append(mgr);
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
419 }
71963b3f802a 8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents: 8827
diff changeset
420
0
a61af66fc99e Initial load
duke
parents:
diff changeset
421 MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) {
a61af66fc99e Initial load
duke
parents:
diff changeset
422 for (int i = 0; i < _managers_list->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
423 MemoryManager* mgr = _managers_list->at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
424 if (mgr->is_manager(mh)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
425 return mgr;
a61af66fc99e Initial load
duke
parents:
diff changeset
426 }
a61af66fc99e Initial load
duke
parents:
diff changeset
427 }
a61af66fc99e Initial load
duke
parents:
diff changeset
428 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
429 }
a61af66fc99e Initial load
duke
parents:
diff changeset
430
a61af66fc99e Initial load
duke
parents:
diff changeset
431 MemoryPool* MemoryService::get_memory_pool(instanceHandle ph) {
a61af66fc99e Initial load
duke
parents:
diff changeset
432 for (int i = 0; i < _pools_list->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
433 MemoryPool* pool = _pools_list->at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
434 if (pool->is_pool(ph)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
435 return pool;
a61af66fc99e Initial load
duke
parents:
diff changeset
436 }
a61af66fc99e Initial load
duke
parents:
diff changeset
437 }
a61af66fc99e Initial load
duke
parents:
diff changeset
438 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
439 }
a61af66fc99e Initial load
duke
parents:
diff changeset
440
a61af66fc99e Initial load
duke
parents:
diff changeset
441 void MemoryService::track_memory_usage() {
a61af66fc99e Initial load
duke
parents:
diff changeset
442 // Track the peak memory usage
a61af66fc99e Initial load
duke
parents:
diff changeset
443 for (int i = 0; i < _pools_list->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
444 MemoryPool* pool = _pools_list->at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
445 pool->record_peak_memory_usage();
a61af66fc99e Initial load
duke
parents:
diff changeset
446 }
a61af66fc99e Initial load
duke
parents:
diff changeset
447
a61af66fc99e Initial load
duke
parents:
diff changeset
448 // Detect low memory
a61af66fc99e Initial load
duke
parents:
diff changeset
449 LowMemoryDetector::detect_low_memory();
a61af66fc99e Initial load
duke
parents:
diff changeset
450 }
a61af66fc99e Initial load
duke
parents:
diff changeset
451
a61af66fc99e Initial load
duke
parents:
diff changeset
452 void MemoryService::track_memory_pool_usage(MemoryPool* pool) {
a61af66fc99e Initial load
duke
parents:
diff changeset
453 // Track the peak memory usage
a61af66fc99e Initial load
duke
parents:
diff changeset
454 pool->record_peak_memory_usage();
a61af66fc99e Initial load
duke
parents:
diff changeset
455
a61af66fc99e Initial load
duke
parents:
diff changeset
456 // Detect low memory
a61af66fc99e Initial load
duke
parents:
diff changeset
457 if (LowMemoryDetector::is_enabled(pool)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
458 LowMemoryDetector::detect_low_memory(pool);
a61af66fc99e Initial load
duke
parents:
diff changeset
459 }
a61af66fc99e Initial load
duke
parents:
diff changeset
460 }
a61af66fc99e Initial load
duke
parents:
diff changeset
461
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
462 void MemoryService::gc_begin(bool fullGC, bool recordGCBeginTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
463 bool recordAccumulatedGCTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
464 bool recordPreGCUsage, bool recordPeakUsage) {
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
465
0
a61af66fc99e Initial load
duke
parents:
diff changeset
466 GCMemoryManager* mgr;
a61af66fc99e Initial load
duke
parents:
diff changeset
467 if (fullGC) {
a61af66fc99e Initial load
duke
parents:
diff changeset
468 mgr = _major_gc_manager;
a61af66fc99e Initial load
duke
parents:
diff changeset
469 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
470 mgr = _minor_gc_manager;
a61af66fc99e Initial load
duke
parents:
diff changeset
471 }
a61af66fc99e Initial load
duke
parents:
diff changeset
472 assert(mgr->is_gc_memory_manager(), "Sanity check");
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
473 mgr->gc_begin(recordGCBeginTime, recordPreGCUsage, recordAccumulatedGCTime);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
474
a61af66fc99e Initial load
duke
parents:
diff changeset
475 // Track the peak memory usage when GC begins
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
476 if (recordPeakUsage) {
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
477 for (int i = 0; i < _pools_list->length(); i++) {
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
478 MemoryPool* pool = _pools_list->at(i);
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
479 pool->record_peak_memory_usage();
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
480 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
481 }
a61af66fc99e Initial load
duke
parents:
diff changeset
482 }
a61af66fc99e Initial load
duke
parents:
diff changeset
483
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
484 void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
485 bool recordAccumulatedGCTime,
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
486 bool recordGCEndTime, bool countCollection,
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
487 GCCause::Cause cause) {
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
488
0
a61af66fc99e Initial load
duke
parents:
diff changeset
489 GCMemoryManager* mgr;
a61af66fc99e Initial load
duke
parents:
diff changeset
490 if (fullGC) {
a61af66fc99e Initial load
duke
parents:
diff changeset
491 mgr = (GCMemoryManager*) _major_gc_manager;
a61af66fc99e Initial load
duke
parents:
diff changeset
492 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
493 mgr = (GCMemoryManager*) _minor_gc_manager;
a61af66fc99e Initial load
duke
parents:
diff changeset
494 }
a61af66fc99e Initial load
duke
parents:
diff changeset
495 assert(mgr->is_gc_memory_manager(), "Sanity check");
a61af66fc99e Initial load
duke
parents:
diff changeset
496
a61af66fc99e Initial load
duke
parents:
diff changeset
497 // register the GC end statistics and memory usage
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
498 mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
499 countCollection, cause);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
500 }
a61af66fc99e Initial load
duke
parents:
diff changeset
501
a61af66fc99e Initial load
duke
parents:
diff changeset
502 void MemoryService::oops_do(OopClosure* f) {
a61af66fc99e Initial load
duke
parents:
diff changeset
503 int i;
a61af66fc99e Initial load
duke
parents:
diff changeset
504
a61af66fc99e Initial load
duke
parents:
diff changeset
505 for (i = 0; i < _pools_list->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
506 MemoryPool* pool = _pools_list->at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
507 pool->oops_do(f);
a61af66fc99e Initial load
duke
parents:
diff changeset
508 }
a61af66fc99e Initial load
duke
parents:
diff changeset
509 for (i = 0; i < _managers_list->length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
510 MemoryManager* mgr = _managers_list->at(i);
a61af66fc99e Initial load
duke
parents:
diff changeset
511 mgr->oops_do(f);
a61af66fc99e Initial load
duke
parents:
diff changeset
512 }
a61af66fc99e Initial load
duke
parents:
diff changeset
513 }
a61af66fc99e Initial load
duke
parents:
diff changeset
514
a61af66fc99e Initial load
duke
parents:
diff changeset
515 bool MemoryService::set_verbose(bool verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
516 MutexLocker m(Management_lock);
a61af66fc99e Initial load
duke
parents:
diff changeset
517 // verbose will be set to the previous value
12322
72b7e96c1922 8024545: make develop and notproduct flag values available in product builds
twisti
parents: 12226
diff changeset
518 bool succeed = CommandLineFlags::boolAtPut((char*)"PrintGC", &verbose, Flag::MANAGEMENT);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
519 assert(succeed, "Setting PrintGC flag fails");
a61af66fc99e Initial load
duke
parents:
diff changeset
520 ClassLoadingService::reset_trace_class_unloading();
a61af66fc99e Initial load
duke
parents:
diff changeset
521
a61af66fc99e Initial load
duke
parents:
diff changeset
522 return verbose;
a61af66fc99e Initial load
duke
parents:
diff changeset
523 }
a61af66fc99e Initial load
duke
parents:
diff changeset
524
a61af66fc99e Initial load
duke
parents:
diff changeset
525 Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
526 Klass* k = Management::java_lang_management_MemoryUsage_klass(CHECK_NH);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
527 instanceKlassHandle ik(THREAD, k);
a61af66fc99e Initial load
duke
parents:
diff changeset
528
a61af66fc99e Initial load
duke
parents:
diff changeset
529 instanceHandle obj = ik->allocate_instance_handle(CHECK_NH);
a61af66fc99e Initial load
duke
parents:
diff changeset
530
a61af66fc99e Initial load
duke
parents:
diff changeset
531 JavaValue result(T_VOID);
a61af66fc99e Initial load
duke
parents:
diff changeset
532 JavaCallArguments args(10);
a61af66fc99e Initial load
duke
parents:
diff changeset
533 args.push_oop(obj); // receiver
a61af66fc99e Initial load
duke
parents:
diff changeset
534 args.push_long(usage.init_size_as_jlong()); // Argument 1
a61af66fc99e Initial load
duke
parents:
diff changeset
535 args.push_long(usage.used_as_jlong()); // Argument 2
a61af66fc99e Initial load
duke
parents:
diff changeset
536 args.push_long(usage.committed_as_jlong()); // Argument 3
a61af66fc99e Initial load
duke
parents:
diff changeset
537 args.push_long(usage.max_size_as_jlong()); // Argument 4
a61af66fc99e Initial load
duke
parents:
diff changeset
538
a61af66fc99e Initial load
duke
parents:
diff changeset
539 JavaCalls::call_special(&result,
a61af66fc99e Initial load
duke
parents:
diff changeset
540 ik,
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
541 vmSymbols::object_initializer_name(),
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
542 vmSymbols::long_long_long_long_void_signature(),
0
a61af66fc99e Initial load
duke
parents:
diff changeset
543 &args,
a61af66fc99e Initial load
duke
parents:
diff changeset
544 CHECK_NH);
a61af66fc99e Initial load
duke
parents:
diff changeset
545 return obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
546 }
a61af66fc99e Initial load
duke
parents:
diff changeset
547 //
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
548 // GC manager type depends on the type of Generation. Depending on the space
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
549 // availablity and vm options the gc uses major gc manager or minor gc
0
a61af66fc99e Initial load
duke
parents:
diff changeset
550 // manager or both. The type of gc manager depends on the generation kind.
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
551 // For DefNew, ParNew and ASParNew generation doing scavenge gc uses minor
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
552 // gc manager (so _fullGC is set to false ) and for other generation kinds
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
553 // doing mark-sweep-compact uses major gc manager (so _fullGC is set
0
a61af66fc99e Initial load
duke
parents:
diff changeset
554 // to true).
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
555 TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
556 switch (kind) {
a61af66fc99e Initial load
duke
parents:
diff changeset
557 case Generation::DefNew:
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
558 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
559 case Generation::ParNew:
a61af66fc99e Initial load
duke
parents:
diff changeset
560 case Generation::ASParNew:
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
561 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
562 _fullGC=false;
a61af66fc99e Initial load
duke
parents:
diff changeset
563 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
564 case Generation::MarkSweepCompact:
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
565 #if INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
566 case Generation::ConcurrentMarkSweep:
a61af66fc99e Initial load
duke
parents:
diff changeset
567 case Generation::ASConcurrentMarkSweep:
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
568 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
569 _fullGC=true;
a61af66fc99e Initial load
duke
parents:
diff changeset
570 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
571 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
572 assert(false, "Unrecognized gc generation kind.");
a61af66fc99e Initial load
duke
parents:
diff changeset
573 }
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
574 // this has to be called in a stop the world pause and represent
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
575 // an entire gc pause, start to finish:
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
576 initialize(_fullGC, cause,true, true, true, true, true, true, true);
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
577 }
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
578 TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
579 GCCause::Cause cause,
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
580 bool recordGCBeginTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
581 bool recordPreGCUsage,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
582 bool recordPeakUsage,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
583 bool recordPostGCUsage,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
584 bool recordAccumulatedGCTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
585 bool recordGCEndTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
586 bool countCollection) {
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
587 initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage,
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
588 recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
589 countCollection);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
590 }
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
591
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
592 // for a subclass to create then initialize an instance before invoking
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
593 // the MemoryService
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
594 void TraceMemoryManagerStats::initialize(bool fullGC,
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
595 GCCause::Cause cause,
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
596 bool recordGCBeginTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
597 bool recordPreGCUsage,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
598 bool recordPeakUsage,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
599 bool recordPostGCUsage,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
600 bool recordAccumulatedGCTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
601 bool recordGCEndTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
602 bool countCollection) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
603 _fullGC = fullGC;
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
604 _recordGCBeginTime = recordGCBeginTime;
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
605 _recordPreGCUsage = recordPreGCUsage;
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
606 _recordPeakUsage = recordPeakUsage;
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
607 _recordPostGCUsage = recordPostGCUsage;
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
608 _recordAccumulatedGCTime = recordAccumulatedGCTime;
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
609 _recordGCEndTime = recordGCEndTime;
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
610 _countCollection = countCollection;
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
611 _cause = cause;
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
612
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
613 MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime,
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
614 _recordPreGCUsage, _recordPeakUsage);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
615 }
a61af66fc99e Initial load
duke
parents:
diff changeset
616
a61af66fc99e Initial load
duke
parents:
diff changeset
617 TraceMemoryManagerStats::~TraceMemoryManagerStats() {
1703
f6f3eef8a521 6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents: 1552
diff changeset
618 MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime,
3356
78542e2b5e35 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 2426
diff changeset
619 _recordGCEndTime, _countCollection, _cause);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
620 }