29 #include "memory/generation.hpp"
30 #include "runtime/handles.hpp"
31 #include "services/memoryUsage.hpp"
32 #include "gc_interface/gcCause.hpp"
33
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;
48 class G1CollectedHeap;
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
104 size_t max_size,
105 bool support_usage_threshold);
106 static MemoryPool* add_survivor_spaces(DefNewGeneration* gen,
107 const char* name,
108 bool is_heap,
109 size_t max_size,
110 bool support_usage_threshold);
111 static MemoryPool* add_gen(Generation* gen,
112 const char* name,
113 bool is_heap,
114 bool support_usage_threshold);
115 static MemoryPool* add_cms_space(CompactibleFreeListSpace* space,
116 const char* name,
117 bool is_heap,
118 size_t max_size,
119 bool support_usage_threshold);
120
121 static void add_gen_collected_heap_info(GenCollectedHeap* heap);
122 static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap);
123 static void add_g1_heap_info(G1CollectedHeap* g1h);
124
125 public:
126 static void set_universe_heap(CollectedHeap* heap);
127 static void add_code_heap_memory_pool(CodeHeap* heap);
128 static void add_metaspace_memory_pools();
129
130 static MemoryPool* get_memory_pool(instanceHandle pool);
131 static MemoryManager* get_memory_manager(instanceHandle mgr);
132
133 static const int num_memory_pools() {
134 return _pools_list->length();
135 }
136 static const int num_memory_managers() {
137 return _managers_list->length();
138 }
139
140 static MemoryPool* get_memory_pool(int index) {
141 return _pools_list->at(index);
142 }
143
|
29 #include "memory/generation.hpp"
30 #include "runtime/handles.hpp"
31 #include "services/memoryUsage.hpp"
32 #include "gc_interface/gcCause.hpp"
33
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;
48 class G1CollectedHeap;
49 class ShenandoahHeap;
50
51 // VM Monitoring and Management Support
52
53 class MemoryService : public AllStatic {
54 private:
55 enum {
56 init_pools_list_size = 10,
57 init_managers_list_size = 5
58 };
59
60 // index for minor and major generations
61 enum {
62 minor = 0,
63 major = 1,
64 n_gens = 2
65 };
66
67 static GrowableArray<MemoryPool*>* _pools_list;
68 static GrowableArray<MemoryManager*>* _managers_list;
69
105 size_t max_size,
106 bool support_usage_threshold);
107 static MemoryPool* add_survivor_spaces(DefNewGeneration* gen,
108 const char* name,
109 bool is_heap,
110 size_t max_size,
111 bool support_usage_threshold);
112 static MemoryPool* add_gen(Generation* gen,
113 const char* name,
114 bool is_heap,
115 bool support_usage_threshold);
116 static MemoryPool* add_cms_space(CompactibleFreeListSpace* space,
117 const char* name,
118 bool is_heap,
119 size_t max_size,
120 bool support_usage_threshold);
121
122 static void add_gen_collected_heap_info(GenCollectedHeap* heap);
123 static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap);
124 static void add_g1_heap_info(G1CollectedHeap* g1h);
125 static void add_shenandoah_heap_info(ShenandoahHeap* heap);
126
127 public:
128 static void set_universe_heap(CollectedHeap* heap);
129 static void add_code_heap_memory_pool(CodeHeap* heap);
130 static void add_metaspace_memory_pools();
131
132 static MemoryPool* get_memory_pool(instanceHandle pool);
133 static MemoryManager* get_memory_manager(instanceHandle mgr);
134
135 static const int num_memory_pools() {
136 return _pools_list->length();
137 }
138 static const int num_memory_managers() {
139 return _managers_list->length();
140 }
141
142 static MemoryPool* get_memory_pool(int index) {
143 return _pools_list->at(index);
144 }
145
|