< prev index next >

src/share/vm/services/memoryPool.cpp

Print this page
rev 12310 : [mq]: gcinterface.patch


  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "gc/serial/defNewGeneration.hpp"
  29 #include "gc/shared/space.hpp"
  30 #include "memory/metaspace.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/handles.inline.hpp"
  33 #include "runtime/javaCalls.hpp"
  34 #include "runtime/orderAccess.inline.hpp"
  35 #include "services/lowMemoryDetector.hpp"
  36 #include "services/management.hpp"
  37 #include "services/memoryManager.hpp"
  38 #include "services/memoryPool.hpp"
  39 #include "utilities/globalDefinitions.hpp"
  40 #include "utilities/macros.hpp"
  41 #if INCLUDE_ALL_GCS
  42 #include "gc/cms/compactibleFreeListSpace.hpp"
  43 #endif
  44 
  45 MemoryPool::MemoryPool(const char* name,
  46                        PoolType type,
  47                        size_t init_size,
  48                        size_t max_size,
  49                        bool support_usage_threshold,
  50                        bool support_gc_threshold) {
  51   _name = name;
  52   _initial_size = init_size;
  53   _max_size = max_size;
  54   (void)const_cast<instanceOop&>(_memory_pool_obj = instanceOop(NULL));
  55   _available_for_allocation = true;
  56   _num_managers = 0;
  57   _type = type;
  58 
  59   // initialize the max and init size of collection usage
  60   _after_gc_usage = MemoryUsage(_initial_size, 0, 0, _max_size);
  61 
  62   _usage_sensor = NULL;
  63   _gc_usage_sensor = NULL;


 211                                                          bool support_usage_threshold) :
 212   CollectedMemoryPool(name, type, young_gen->from()->capacity(), max_size,
 213                       support_usage_threshold), _young_gen(young_gen) {
 214 }
 215 
 216 size_t SurvivorContiguousSpacePool::used_in_bytes() {
 217   return _young_gen->from()->used();
 218 }
 219 
 220 size_t SurvivorContiguousSpacePool::committed_in_bytes() {
 221   return _young_gen->from()->capacity();
 222 }
 223 
 224 MemoryUsage SurvivorContiguousSpacePool::get_memory_usage() {
 225   size_t maxSize = (available_for_allocation() ? max_size() : 0);
 226   size_t used    = used_in_bytes();
 227   size_t committed = committed_in_bytes();
 228 
 229   return MemoryUsage(initial_size(), used, committed, maxSize);
 230 }
 231 
 232 #if INCLUDE_ALL_GCS
 233 CompactibleFreeListSpacePool::CompactibleFreeListSpacePool(CompactibleFreeListSpace* space,
 234                                                            const char* name,
 235                                                            PoolType type,
 236                                                            size_t max_size,
 237                                                            bool support_usage_threshold) :
 238   CollectedMemoryPool(name, type, space->capacity(), max_size,
 239                       support_usage_threshold), _space(space) {
 240 }
 241 
 242 size_t CompactibleFreeListSpacePool::used_in_bytes() {
 243   return _space->used();
 244 }
 245 
 246 MemoryUsage CompactibleFreeListSpacePool::get_memory_usage() {
 247   size_t maxSize   = (available_for_allocation() ? max_size() : 0);
 248   size_t used      = used_in_bytes();
 249   size_t committed = _space->capacity();
 250 
 251   return MemoryUsage(initial_size(), used, committed, maxSize);
 252 }
 253 #endif // INCLUDE_ALL_GCS
 254 
 255 GenerationPool::GenerationPool(Generation* gen,
 256                                const char* name,
 257                                PoolType type,
 258                                bool support_usage_threshold) :
 259   CollectedMemoryPool(name, type, gen->capacity(), gen->max_capacity(),
 260                       support_usage_threshold), _gen(gen) {
 261 }
 262 
 263 size_t GenerationPool::used_in_bytes() {
 264   return _gen->used();
 265 }
 266 
 267 MemoryUsage GenerationPool::get_memory_usage() {
 268   size_t used      = used_in_bytes();
 269   size_t committed = _gen->capacity();
 270   size_t maxSize   = (available_for_allocation() ? max_size() : 0);
 271 
 272   return MemoryUsage(initial_size(), used, committed, maxSize);
 273 }




  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "gc/serial/defNewGeneration.hpp"
  29 #include "gc/shared/space.hpp"
  30 #include "memory/metaspace.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/handles.inline.hpp"
  33 #include "runtime/javaCalls.hpp"
  34 #include "runtime/orderAccess.inline.hpp"
  35 #include "services/lowMemoryDetector.hpp"
  36 #include "services/management.hpp"
  37 #include "services/memoryManager.hpp"
  38 #include "services/memoryPool.hpp"
  39 #include "utilities/globalDefinitions.hpp"
  40 #include "utilities/macros.hpp"



  41 
  42 MemoryPool::MemoryPool(const char* name,
  43                        PoolType type,
  44                        size_t init_size,
  45                        size_t max_size,
  46                        bool support_usage_threshold,
  47                        bool support_gc_threshold) {
  48   _name = name;
  49   _initial_size = init_size;
  50   _max_size = max_size;
  51   (void)const_cast<instanceOop&>(_memory_pool_obj = instanceOop(NULL));
  52   _available_for_allocation = true;
  53   _num_managers = 0;
  54   _type = type;
  55 
  56   // initialize the max and init size of collection usage
  57   _after_gc_usage = MemoryUsage(_initial_size, 0, 0, _max_size);
  58 
  59   _usage_sensor = NULL;
  60   _gc_usage_sensor = NULL;


 208                                                          bool support_usage_threshold) :
 209   CollectedMemoryPool(name, type, young_gen->from()->capacity(), max_size,
 210                       support_usage_threshold), _young_gen(young_gen) {
 211 }
 212 
 213 size_t SurvivorContiguousSpacePool::used_in_bytes() {
 214   return _young_gen->from()->used();
 215 }
 216 
 217 size_t SurvivorContiguousSpacePool::committed_in_bytes() {
 218   return _young_gen->from()->capacity();
 219 }
 220 
 221 MemoryUsage SurvivorContiguousSpacePool::get_memory_usage() {
 222   size_t maxSize = (available_for_allocation() ? max_size() : 0);
 223   size_t used    = used_in_bytes();
 224   size_t committed = committed_in_bytes();
 225 
 226   return MemoryUsage(initial_size(), used, committed, maxSize);
 227 }























 228 
 229 GenerationPool::GenerationPool(Generation* gen,
 230                                const char* name,
 231                                PoolType type,
 232                                bool support_usage_threshold) :
 233   CollectedMemoryPool(name, type, gen->capacity(), gen->max_capacity(),
 234                       support_usage_threshold), _gen(gen) {
 235 }
 236 
 237 size_t GenerationPool::used_in_bytes() {
 238   return _gen->used();
 239 }
 240 
 241 MemoryUsage GenerationPool::get_memory_usage() {
 242   size_t used      = used_in_bytes();
 243   size_t committed = _gen->capacity();
 244   size_t maxSize   = (available_for_allocation() ? max_size() : 0);
 245 
 246   return MemoryUsage(initial_size(), used, committed, maxSize);
 247 }


< prev index next >