Mercurial > hg > graal-compiler
annotate src/share/vm/services/memoryService.hpp @ 3318:188c9a5d6a6d
7040485: Use transparent huge page on linux by default
Summary: Turn on UseLargePages by default but try only HugeTLBFS method if it is not explicitly specified on the command line.
Reviewed-by: ysr
author | iveresov |
---|---|
date | Fri, 29 Apr 2011 12:39:32 -0700 |
parents | f95d63e2154a |
children | 78542e2b5e35 |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
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 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_SERVICES_MEMORYSERVICE_HPP |
26 #define SHARE_VM_SERVICES_MEMORYSERVICE_HPP | |
27 | |
28 #include "memory/allocation.hpp" | |
29 #include "memory/generation.hpp" | |
30 #include "runtime/handles.hpp" | |
31 #include "services/memoryUsage.hpp" | |
32 | |
0 | 33 // Forward declaration |
34 class MemoryPool; | |
35 class MemoryManager; | |
36 class GCMemoryManager; | |
37 class CollectedHeap; | |
38 class Generation; | |
39 class DefNewGeneration; | |
40 class PSYoungGen; | |
41 class PSOldGen; | |
42 class PSPermGen; | |
43 class CodeHeap; | |
44 class ContiguousSpace; | |
45 class CompactibleFreeListSpace; | |
46 class PermanentGenerationSpec; | |
47 class GenCollectedHeap; | |
48 class ParallelScavengeHeap; | |
49 class CompactingPermGenGen; | |
50 class CMSPermGenGen; | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
51 class G1CollectedHeap; |
0 | 52 |
53 // VM Monitoring and Management Support | |
54 | |
55 class MemoryService : public AllStatic { | |
56 private: | |
57 enum { | |
58 init_pools_list_size = 10, | |
59 init_managers_list_size = 5 | |
60 }; | |
61 | |
62 // index for minor and major generations | |
63 enum { | |
64 minor = 0, | |
65 major = 1, | |
66 n_gens = 2 | |
67 }; | |
68 | |
69 static GrowableArray<MemoryPool*>* _pools_list; | |
70 static GrowableArray<MemoryManager*>* _managers_list; | |
71 | |
72 // memory managers for minor and major GC statistics | |
73 static GCMemoryManager* _major_gc_manager; | |
74 static GCMemoryManager* _minor_gc_manager; | |
75 | |
76 // Code heap memory pool | |
77 static MemoryPool* _code_heap_pool; | |
78 | |
79 static void add_generation_memory_pool(Generation* gen, | |
80 MemoryManager* major_mgr, | |
81 MemoryManager* minor_mgr); | |
82 static void add_generation_memory_pool(Generation* gen, | |
83 MemoryManager* major_mgr) { | |
84 add_generation_memory_pool(gen, major_mgr, NULL); | |
85 } | |
86 | |
87 static void add_compact_perm_gen_memory_pool(CompactingPermGenGen* perm_gen, | |
88 MemoryManager* mgr); | |
89 static void add_cms_perm_gen_memory_pool(CMSPermGenGen* perm_gen, | |
90 MemoryManager* mgr); | |
91 | |
92 static void add_psYoung_memory_pool(PSYoungGen* gen, | |
93 MemoryManager* major_mgr, | |
94 MemoryManager* minor_mgr); | |
95 static void add_psOld_memory_pool(PSOldGen* gen, | |
96 MemoryManager* mgr); | |
97 static void add_psPerm_memory_pool(PSPermGen* perm, | |
98 MemoryManager* mgr); | |
99 | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
100 static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
101 MemoryManager* major_mgr, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
102 MemoryManager* minor_mgr); |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
103 static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
104 MemoryManager* mgr); |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
105 static void add_g1PermGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
106 MemoryManager* mgr); |
0 | 107 |
108 static MemoryPool* add_space(ContiguousSpace* space, | |
109 const char* name, | |
110 bool is_heap, | |
111 size_t max_size, | |
112 bool support_usage_threshold); | |
113 static MemoryPool* add_survivor_spaces(DefNewGeneration* gen, | |
114 const char* name, | |
115 bool is_heap, | |
116 size_t max_size, | |
117 bool support_usage_threshold); | |
118 static MemoryPool* add_gen(Generation* gen, | |
119 const char* name, | |
120 bool is_heap, | |
121 bool support_usage_threshold); | |
122 static MemoryPool* add_cms_space(CompactibleFreeListSpace* space, | |
123 const char* name, | |
124 bool is_heap, | |
125 size_t max_size, | |
126 bool support_usage_threshold); | |
127 | |
128 static void add_gen_collected_heap_info(GenCollectedHeap* heap); | |
129 static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap); | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
130 static void add_g1_heap_info(G1CollectedHeap* g1h); |
0 | 131 |
132 public: | |
133 static void set_universe_heap(CollectedHeap* heap); | |
134 static void add_code_heap_memory_pool(CodeHeap* heap); | |
135 | |
136 static MemoryPool* get_memory_pool(instanceHandle pool); | |
137 static MemoryManager* get_memory_manager(instanceHandle mgr); | |
138 | |
139 static const int num_memory_pools() { | |
140 return _pools_list->length(); | |
141 } | |
142 static const int num_memory_managers() { | |
143 return _managers_list->length(); | |
144 } | |
145 | |
146 static MemoryPool* get_memory_pool(int index) { | |
147 return _pools_list->at(index); | |
148 } | |
149 | |
150 static MemoryManager* get_memory_manager(int index) { | |
151 return _managers_list->at(index); | |
152 } | |
153 | |
154 static void track_memory_usage(); | |
155 static void track_code_cache_memory_usage() { | |
156 track_memory_pool_usage(_code_heap_pool); | |
157 } | |
158 static void track_memory_pool_usage(MemoryPool* pool); | |
159 | |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
160 static void 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
|
161 bool recordAccumulatedGCTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
162 bool recordPreGCUsage, bool recordPeakUsage); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
163 static void 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
|
164 bool recordAccumulatedGCTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
165 bool recordGCEndTime, bool countCollection); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
166 |
0 | 167 |
168 static void oops_do(OopClosure* f); | |
169 | |
170 static bool get_verbose() { return PrintGC; } | |
171 static bool set_verbose(bool verbose); | |
172 | |
173 // Create an instance of java/lang/management/MemoryUsage | |
174 static Handle create_MemoryUsage_obj(MemoryUsage usage, TRAPS); | |
175 }; | |
176 | |
177 class TraceMemoryManagerStats : public StackObj { | |
178 private: | |
179 bool _fullGC; | |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
180 bool _recordGCBeginTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
181 bool _recordPreGCUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
182 bool _recordPeakUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
183 bool _recordPostGCUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
184 bool _recordAccumulatedGCTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
185 bool _recordGCEndTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
186 bool _countCollection; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
187 |
0 | 188 public: |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
189 TraceMemoryManagerStats() {} |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
190 TraceMemoryManagerStats(bool fullGC, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
191 bool recordGCBeginTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
192 bool recordPreGCUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
193 bool recordPeakUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
194 bool recordPostGCUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
195 bool recordAccumulatedGCTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
196 bool recordGCEndTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
197 bool countCollection = true); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
198 |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
199 void initialize(bool fullGC, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
200 bool recordGCBeginTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
201 bool recordPreGCUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
202 bool recordPeakUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
203 bool recordPostGCUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
204 bool recordAccumulatedGCTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
205 bool recordGCEndTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
206 bool countCollection); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
207 |
0 | 208 TraceMemoryManagerStats(Generation::Name kind); |
209 ~TraceMemoryManagerStats(); | |
210 }; | |
1972 | 211 |
212 #endif // SHARE_VM_SERVICES_MEMORYSERVICE_HPP |