< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahMemoryPool.cpp

Print this page
*** 22,18 ***
   *
   */
  
  #include "precompiled.hpp"
  #include "gc/shenandoah/shenandoahMemoryPool.hpp"
  
! ShenandoahMemoryPool::ShenandoahMemoryPool(ShenandoahHeap* heap) :
!         CollectedMemoryPool("Shenandoah",
                              heap->initial_capacity(),
                              heap->max_capacity(),
                              true /* support_usage_threshold */),
                              _heap(heap) {}
  
  MemoryUsage ShenandoahMemoryPool::get_memory_usage() {
    size_t initial   = initial_size();
    size_t max       = max_size();
    size_t used      = used_in_bytes();
    size_t committed = _heap->committed();
--- 22,32 ---
   *
   */
  
  #include "precompiled.hpp"
  #include "gc/shenandoah/shenandoahMemoryPool.hpp"
+ #include "gc/shenandoah/shenandoahYoungGeneration.hpp"
+ #include "gc/shenandoah/shenandoahOldGeneration.hpp"
  
! ShenandoahMemoryPool::ShenandoahMemoryPool(ShenandoahHeap* heap,
!                                            const char* name) :
+         CollectedMemoryPool(name,
                              heap->initial_capacity(),
                              heap->max_capacity(),
                              true /* support_usage_threshold */),
                              _heap(heap) {}
  
+ ShenandoahMemoryPool::ShenandoahMemoryPool(ShenandoahHeap* heap,
+                                            const char* name,
+                                            size_t initial_capacity,
+                                            size_t max_capacity) :
+         CollectedMemoryPool(name,
+                             initial_capacity,
+                             max_capacity,
+                             true /* support_usage_threshold */),
+                             _heap(heap) {}
+ 
+ 
  MemoryUsage ShenandoahMemoryPool::get_memory_usage() {
    size_t initial   = initial_size();
    size_t max       = max_size();
    size_t used      = used_in_bytes();
    size_t committed = _heap->committed();

*** 49,5 ***
--- 63,59 ---
    committed = MAX2(used, committed);
    assert(used <= committed, "used: "      SIZE_FORMAT ", committed: " SIZE_FORMAT, used,      committed);
  
    return MemoryUsage(initial, used, committed, max);
  }
+ 
+ size_t ShenandoahMemoryPool::used_in_bytes() {
+   return _heap->used();
+ }
+ 
+ size_t ShenandoahMemoryPool::max_size() const {
+   return _heap->max_capacity();
+ }
+ 
+ ShenandoahYoungGenMemoryPool::ShenandoahYoungGenMemoryPool(ShenandoahHeap* heap) :
+         ShenandoahMemoryPool(heap,
+                              "Shenandoah Young Gen",
+                              0,
+                              heap->max_capacity()) { }
+ 
+ MemoryUsage ShenandoahYoungGenMemoryPool::get_memory_usage() {
+   size_t initial   = initial_size();
+   size_t max       = max_size();
+   size_t used      = used_in_bytes();
+   size_t committed = _heap->young_generation()->used_regions_size();
+ 
+   return MemoryUsage(initial, used, committed, max);
+ }
+ 
+ size_t ShenandoahYoungGenMemoryPool::used_in_bytes() {
+   return _heap->young_generation()->used();
+ }
+ 
+ size_t ShenandoahYoungGenMemoryPool::max_size() const {
+   return _heap->young_generation()->max_capacity();
+ }
+ 
+ ShenandoahOldGenMemoryPool::ShenandoahOldGenMemoryPool(ShenandoahHeap* heap) :
+         ShenandoahMemoryPool(heap,
+                              "Shenandoah Old Gen",
+                              0,
+                              heap->max_capacity()) { }
+ 
+ MemoryUsage ShenandoahOldGenMemoryPool::get_memory_usage() {
+   size_t initial   = initial_size();
+   size_t max       = max_size();
+   size_t used      = used_in_bytes();
+   size_t committed = _heap->old_generation()->used_regions_size();
+ 
+   return MemoryUsage(initial, used, committed, max);
+ }
+ 
+ size_t ShenandoahOldGenMemoryPool::used_in_bytes() {
+   return _heap->old_generation()->used();
+ }
+ 
+ size_t ShenandoahOldGenMemoryPool::max_size() const {
+   return _heap->old_generation()->max_capacity();
+ }
< prev index next >