Mercurial > hg > truffle
annotate src/share/vm/services/memoryService.hpp @ 14247:2e96b2d61686
8031530: [TESTBUG] Enable test runtime/LoadClass/LoadClassNegative.java
Summary: Re-enabled the test. The issue that prevents this test from running was fixed by 8020675
Reviewed-by: sla, ccheung
author | zgu |
---|---|
date | Mon, 13 Jan 2014 10:05:37 -0500 |
parents | de6a9e811145 |
children | 4ca6dc0799b6 |
rev | line source |
---|---|
0 | 1 /* |
14223
de6a9e811145
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
12839
diff
changeset
|
2 * Copyright (c) 2003, 2013, 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" | |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
32 #include "gc_interface/gcCause.hpp" |
1972 | 33 |
0 | 34 // Forward declaration |
35 class MemoryPool; | |
36 class MemoryManager; | |
37 class GCMemoryManager; | |
38 class CollectedHeap; | |
39 class Generation; | |
40 class DefNewGeneration; | |
41 class PSYoungGen; | |
42 class PSOldGen; | |
43 class CodeHeap; | |
44 class ContiguousSpace; | |
45 class CompactibleFreeListSpace; | |
46 class GenCollectedHeap; | |
47 class ParallelScavengeHeap; | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
48 class G1CollectedHeap; |
0 | 49 |
50 // VM Monitoring and Management Support | |
51 | |
52 class MemoryService : public AllStatic { | |
53 private: | |
54 enum { | |
55 init_pools_list_size = 10, | |
56 init_managers_list_size = 5 | |
57 }; | |
58 | |
59 // index for minor and major generations | |
60 enum { | |
61 minor = 0, | |
62 major = 1, | |
63 n_gens = 2 | |
64 }; | |
65 | |
66 static GrowableArray<MemoryPool*>* _pools_list; | |
67 static GrowableArray<MemoryManager*>* _managers_list; | |
68 | |
69 // memory managers for minor and major GC statistics | |
70 static GCMemoryManager* _major_gc_manager; | |
71 static GCMemoryManager* _minor_gc_manager; | |
72 | |
73 // Code heap memory pool | |
74 static MemoryPool* _code_heap_pool; | |
75 | |
11039
71963b3f802a
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
8827
diff
changeset
|
76 static MemoryPool* _metaspace_pool; |
71963b3f802a
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
8827
diff
changeset
|
77 static MemoryPool* _compressed_class_pool; |
71963b3f802a
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
8827
diff
changeset
|
78 |
0 | 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 | |
88 static void add_psYoung_memory_pool(PSYoungGen* gen, | |
89 MemoryManager* major_mgr, | |
90 MemoryManager* minor_mgr); | |
91 static void add_psOld_memory_pool(PSOldGen* gen, | |
92 MemoryManager* mgr); | |
93 | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
94 static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
95 MemoryManager* major_mgr, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
96 MemoryManager* minor_mgr); |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
97 static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
98 MemoryManager* mgr); |
0 | 99 |
100 static MemoryPool* add_space(ContiguousSpace* space, | |
101 const char* name, | |
102 bool is_heap, | |
103 size_t max_size, | |
104 bool support_usage_threshold); | |
105 static MemoryPool* add_survivor_spaces(DefNewGeneration* gen, | |
106 const char* name, | |
107 bool is_heap, | |
108 size_t max_size, | |
109 bool support_usage_threshold); | |
110 static MemoryPool* add_gen(Generation* gen, | |
111 const char* name, | |
112 bool is_heap, | |
113 bool support_usage_threshold); | |
114 static MemoryPool* add_cms_space(CompactibleFreeListSpace* space, | |
115 const char* name, | |
116 bool is_heap, | |
117 size_t max_size, | |
118 bool support_usage_threshold); | |
119 | |
120 static void add_gen_collected_heap_info(GenCollectedHeap* heap); | |
121 static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap); | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
122 static void add_g1_heap_info(G1CollectedHeap* g1h); |
0 | 123 |
124 public: | |
125 static void set_universe_heap(CollectedHeap* heap); | |
126 static void add_code_heap_memory_pool(CodeHeap* heap); | |
11039
71963b3f802a
8013590: NPG: Add a memory pool MXBean for Metaspace
ehelin
parents:
8827
diff
changeset
|
127 static void add_metaspace_memory_pools(); |
0 | 128 |
129 static MemoryPool* get_memory_pool(instanceHandle pool); | |
130 static MemoryManager* get_memory_manager(instanceHandle mgr); | |
131 | |
132 static const int num_memory_pools() { | |
133 return _pools_list->length(); | |
134 } | |
135 static const int num_memory_managers() { | |
136 return _managers_list->length(); | |
137 } | |
138 | |
139 static MemoryPool* get_memory_pool(int index) { | |
140 return _pools_list->at(index); | |
141 } | |
142 | |
143 static MemoryManager* get_memory_manager(int index) { | |
144 return _managers_list->at(index); | |
145 } | |
146 | |
147 static void track_memory_usage(); | |
148 static void track_code_cache_memory_usage() { | |
149 track_memory_pool_usage(_code_heap_pool); | |
150 } | |
12839
a6414751d537
8025996: Track metaspace usage when metaspace is expanded
stefank
parents:
11039
diff
changeset
|
151 static void track_metaspace_memory_usage() { |
a6414751d537
8025996: Track metaspace usage when metaspace is expanded
stefank
parents:
11039
diff
changeset
|
152 track_memory_pool_usage(_metaspace_pool); |
a6414751d537
8025996: Track metaspace usage when metaspace is expanded
stefank
parents:
11039
diff
changeset
|
153 } |
a6414751d537
8025996: Track metaspace usage when metaspace is expanded
stefank
parents:
11039
diff
changeset
|
154 static void track_compressed_class_memory_usage() { |
a6414751d537
8025996: Track metaspace usage when metaspace is expanded
stefank
parents:
11039
diff
changeset
|
155 track_memory_pool_usage(_compressed_class_pool); |
a6414751d537
8025996: Track metaspace usage when metaspace is expanded
stefank
parents:
11039
diff
changeset
|
156 } |
0 | 157 static void track_memory_pool_usage(MemoryPool* pool); |
158 | |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
159 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
|
160 bool recordAccumulatedGCTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
161 bool recordPreGCUsage, bool recordPeakUsage); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
162 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
|
163 bool recordAccumulatedGCTime, |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
164 bool recordGCEndTime, bool countCollection, |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
165 GCCause::Cause cause); |
1703
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); | |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
175 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
176 static const GCMemoryManager* get_minor_gc_manager() { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
177 return _minor_gc_manager; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
178 } |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
179 |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
180 static const GCMemoryManager* get_major_gc_manager() { |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
181 return _major_gc_manager; |
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
182 } |
0 | 183 }; |
184 | |
185 class TraceMemoryManagerStats : public StackObj { | |
186 private: | |
187 bool _fullGC; | |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
188 bool _recordGCBeginTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
189 bool _recordPreGCUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
190 bool _recordPeakUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
191 bool _recordPostGCUsage; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
192 bool _recordAccumulatedGCTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
193 bool _recordGCEndTime; |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
194 bool _countCollection; |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
195 GCCause::Cause _cause; |
0 | 196 public: |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
197 TraceMemoryManagerStats() {} |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
198 TraceMemoryManagerStats(bool fullGC, |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
199 GCCause::Cause cause, |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
200 bool recordGCBeginTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
201 bool recordPreGCUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
202 bool recordPeakUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
203 bool recordPostGCUsage = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
204 bool recordAccumulatedGCTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
205 bool recordGCEndTime = true, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
206 bool countCollection = true); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
207 |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
208 void initialize(bool fullGC, |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
209 GCCause::Cause cause, |
1703
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
210 bool recordGCBeginTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
211 bool recordPreGCUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
212 bool recordPeakUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
213 bool recordPostGCUsage, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
214 bool recordAccumulatedGCTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
215 bool recordGCEndTime, |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
216 bool countCollection); |
f6f3eef8a521
6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
kevinw
parents:
1552
diff
changeset
|
217 |
3356
78542e2b5e35
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents:
1972
diff
changeset
|
218 TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause); |
0 | 219 ~TraceMemoryManagerStats(); |
220 }; | |
1972 | 221 |
222 #endif // SHARE_VM_SERVICES_MEMORYSERVICE_HPP |