Mercurial > hg > graal-compiler
annotate src/share/vm/services/memoryService.hpp @ 1397:b4776199210f
6943485: JVMTI always on capabilities change code generation too much
Reviewed-by: twisti, dcubed
author | never |
---|---|
date | Mon, 26 Apr 2010 23:59:45 -0700 |
parents | db0d5eba9d20 |
children | c18cbe5936b8 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. | |
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 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 // Forward declaration | |
26 class MemoryPool; | |
27 class MemoryManager; | |
28 class GCMemoryManager; | |
29 class CollectedHeap; | |
30 class Generation; | |
31 class DefNewGeneration; | |
32 class PSYoungGen; | |
33 class PSOldGen; | |
34 class PSPermGen; | |
35 class CodeHeap; | |
36 class ContiguousSpace; | |
37 class CompactibleFreeListSpace; | |
38 class PermanentGenerationSpec; | |
39 class GenCollectedHeap; | |
40 class ParallelScavengeHeap; | |
41 class CompactingPermGenGen; | |
42 class CMSPermGenGen; | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
43 class G1CollectedHeap; |
0 | 44 |
45 // VM Monitoring and Management Support | |
46 | |
47 class MemoryService : public AllStatic { | |
48 private: | |
49 enum { | |
50 init_pools_list_size = 10, | |
51 init_managers_list_size = 5 | |
52 }; | |
53 | |
54 // index for minor and major generations | |
55 enum { | |
56 minor = 0, | |
57 major = 1, | |
58 n_gens = 2 | |
59 }; | |
60 | |
61 static GrowableArray<MemoryPool*>* _pools_list; | |
62 static GrowableArray<MemoryManager*>* _managers_list; | |
63 | |
64 // memory managers for minor and major GC statistics | |
65 static GCMemoryManager* _major_gc_manager; | |
66 static GCMemoryManager* _minor_gc_manager; | |
67 | |
68 // Code heap memory pool | |
69 static MemoryPool* _code_heap_pool; | |
70 | |
71 static void add_generation_memory_pool(Generation* gen, | |
72 MemoryManager* major_mgr, | |
73 MemoryManager* minor_mgr); | |
74 static void add_generation_memory_pool(Generation* gen, | |
75 MemoryManager* major_mgr) { | |
76 add_generation_memory_pool(gen, major_mgr, NULL); | |
77 } | |
78 | |
79 static void add_compact_perm_gen_memory_pool(CompactingPermGenGen* perm_gen, | |
80 MemoryManager* mgr); | |
81 static void add_cms_perm_gen_memory_pool(CMSPermGenGen* perm_gen, | |
82 MemoryManager* mgr); | |
83 | |
84 static void add_psYoung_memory_pool(PSYoungGen* gen, | |
85 MemoryManager* major_mgr, | |
86 MemoryManager* minor_mgr); | |
87 static void add_psOld_memory_pool(PSOldGen* gen, | |
88 MemoryManager* mgr); | |
89 static void add_psPerm_memory_pool(PSPermGen* perm, | |
90 MemoryManager* mgr); | |
91 | |
1089
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
92 static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
93 MemoryManager* major_mgr, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
94 MemoryManager* minor_mgr); |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
95 static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h, |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
96 MemoryManager* mgr); |
db0d5eba9d20
6815790: G1: Missing MemoryPoolMXBeans with -XX:+UseG1GC
tonyp
parents:
0
diff
changeset
|
97 static void add_g1PermGen_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); | |
127 | |
128 static MemoryPool* get_memory_pool(instanceHandle pool); | |
129 static MemoryManager* get_memory_manager(instanceHandle mgr); | |
130 | |
131 static const int num_memory_pools() { | |
132 return _pools_list->length(); | |
133 } | |
134 static const int num_memory_managers() { | |
135 return _managers_list->length(); | |
136 } | |
137 | |
138 static MemoryPool* get_memory_pool(int index) { | |
139 return _pools_list->at(index); | |
140 } | |
141 | |
142 static MemoryManager* get_memory_manager(int index) { | |
143 return _managers_list->at(index); | |
144 } | |
145 | |
146 static void track_memory_usage(); | |
147 static void track_code_cache_memory_usage() { | |
148 track_memory_pool_usage(_code_heap_pool); | |
149 } | |
150 static void track_memory_pool_usage(MemoryPool* pool); | |
151 | |
152 static void gc_begin(bool fullGC); | |
153 static void gc_end(bool fullGC); | |
154 | |
155 static void oops_do(OopClosure* f); | |
156 | |
157 static bool get_verbose() { return PrintGC; } | |
158 static bool set_verbose(bool verbose); | |
159 | |
160 // Create an instance of java/lang/management/MemoryUsage | |
161 static Handle create_MemoryUsage_obj(MemoryUsage usage, TRAPS); | |
162 }; | |
163 | |
164 class TraceMemoryManagerStats : public StackObj { | |
165 private: | |
166 bool _fullGC; | |
167 public: | |
168 TraceMemoryManagerStats(bool fullGC); | |
169 TraceMemoryManagerStats(Generation::Name kind); | |
170 ~TraceMemoryManagerStats(); | |
171 }; |