src/share/vm/services/memoryService.hpp

Print this page
rev 4210 : 8000754: NPG: Implement a MemoryPool MXBean for Metaspace


  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 




  76   static void add_generation_memory_pool(Generation* gen,
  77                                          MemoryManager* major_mgr,
  78                                          MemoryManager* minor_mgr);
  79   static void add_generation_memory_pool(Generation* gen,
  80                                          MemoryManager* major_mgr) {
  81     add_generation_memory_pool(gen, major_mgr, NULL);
  82   }
  83 
  84 
  85   static void add_psYoung_memory_pool(PSYoungGen* gen,
  86                                       MemoryManager* major_mgr,
  87                                       MemoryManager* minor_mgr);
  88   static void add_psOld_memory_pool(PSOldGen* gen,
  89                                     MemoryManager* mgr);
  90 
  91   static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
  92                                          MemoryManager* major_mgr,
  93                                          MemoryManager* minor_mgr);
  94   static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
  95                                        MemoryManager* mgr);


 104                                          bool is_heap,
 105                                          size_t max_size,
 106                                          bool support_usage_threshold);
 107   static MemoryPool* add_gen(Generation* gen,
 108                              const char* name,
 109                              bool is_heap,
 110                              bool support_usage_threshold);
 111   static MemoryPool* add_cms_space(CompactibleFreeListSpace* space,
 112                                    const char* name,
 113                                    bool is_heap,
 114                                    size_t max_size,
 115                                    bool support_usage_threshold);
 116 
 117   static void add_gen_collected_heap_info(GenCollectedHeap* heap);
 118   static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap);
 119   static void add_g1_heap_info(G1CollectedHeap* g1h);
 120 
 121 public:
 122   static void set_universe_heap(CollectedHeap* heap);
 123   static void add_code_heap_memory_pool(CodeHeap* heap);

 124 
 125   static MemoryPool*    get_memory_pool(instanceHandle pool);
 126   static MemoryManager* get_memory_manager(instanceHandle mgr);
 127 
 128   static const int num_memory_pools() {
 129     return _pools_list->length();
 130   }
 131   static const int num_memory_managers() {
 132     return _managers_list->length();
 133   }
 134 
 135   static MemoryPool* get_memory_pool(int index) {
 136     return _pools_list->at(index);
 137   }
 138 
 139   static MemoryManager* get_memory_manager(int index) {
 140     return _managers_list->at(index);
 141   }
 142 
 143   static void track_memory_usage();




  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 
  76   // Metaspace pools
  77   static MemoryPool*                    _metaspace_pool;
  78   static MemoryPool*                    _class_metaspace_pool;
  79 
  80   static void add_generation_memory_pool(Generation* gen,
  81                                          MemoryManager* major_mgr,
  82                                          MemoryManager* minor_mgr);
  83   static void add_generation_memory_pool(Generation* gen,
  84                                          MemoryManager* major_mgr) {
  85     add_generation_memory_pool(gen, major_mgr, NULL);
  86   }
  87 
  88 
  89   static void add_psYoung_memory_pool(PSYoungGen* gen,
  90                                       MemoryManager* major_mgr,
  91                                       MemoryManager* minor_mgr);
  92   static void add_psOld_memory_pool(PSOldGen* gen,
  93                                     MemoryManager* mgr);
  94 
  95   static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
  96                                          MemoryManager* major_mgr,
  97                                          MemoryManager* minor_mgr);
  98   static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
  99                                        MemoryManager* mgr);


 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 
 144   static MemoryManager* get_memory_manager(int index) {
 145     return _managers_list->at(index);
 146   }
 147 
 148   static void track_memory_usage();