< prev index next >

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

Print this page




  29 #include "gc/shenandoah/shenandoahHeap.hpp"
  30 #include "gc/shenandoah/shenandoahHeapRegionCounters.hpp"
  31 #include "memory/metaspaceCounters.hpp"
  32 #include "services/memoryService.hpp"
  33 
  34 class ShenandoahYoungGenerationCounters : public GenerationCounters {
  35 public:
  36   ShenandoahYoungGenerationCounters() :
  37           GenerationCounters("Young", 0, 0, 0, (size_t)0, (size_t)0) {};
  38 
  39   virtual void update_all() {
  40     // no update
  41   }
  42 };
  43 
  44 class ShenandoahGenerationCounters : public GenerationCounters {
  45 private:
  46   ShenandoahHeap* _heap;
  47 public:
  48   ShenandoahGenerationCounters(ShenandoahHeap* heap) :
  49           GenerationCounters("Heap", 1, 1, heap->initial_capacity(), heap->max_capacity(), heap->capacity()),
  50           _heap(heap)
  51   {};
  52 
  53   virtual void update_all() {
  54     _current_size->set_value(_heap->capacity());
  55   }
  56 };
  57 
  58 ShenandoahMonitoringSupport::ShenandoahMonitoringSupport(ShenandoahHeap* heap) :
  59         _partial_counters(NULL),
  60         _full_counters(NULL)
  61 {
  62   // Collection counters do not fit Shenandoah very well.
  63   // We record partial cycles as "young", and full cycles (including full STW GC) as "old".
  64   _partial_counters  = new CollectorCounters("Shenandoah partial", 0);
  65   _full_counters     = new CollectorCounters("Shenandoah full",    1);
  66 
  67   // We report young gen as unused.
  68   _young_counters = new ShenandoahYoungGenerationCounters();
  69   _heap_counters  = new ShenandoahGenerationCounters(heap);
  70   _space_counters = new HSpaceCounters(_heap_counters->name_space(), "Heap", 0, heap->max_capacity(), heap->initial_capacity());
  71 
  72   _heap_region_counters = new ShenandoahHeapRegionCounters();
  73 }
  74 


  77 }
  78 
  79 CollectorCounters* ShenandoahMonitoringSupport::full_stw_collection_counters() {
  80   return _full_counters;
  81 }
  82 
  83 CollectorCounters* ShenandoahMonitoringSupport::concurrent_collection_counters() {
  84   return _full_counters;
  85 }
  86 
  87 CollectorCounters* ShenandoahMonitoringSupport::partial_collection_counters() {
  88   return _partial_counters;
  89 }
  90 
  91 void ShenandoahMonitoringSupport::update_counters() {
  92   MemoryService::track_memory_usage();
  93 
  94   if (UsePerfData) {
  95     ShenandoahHeap* heap = ShenandoahHeap::heap();
  96     size_t used = heap->used();
  97     size_t capacity = heap->max_capacity();
  98     _heap_counters->update_all();
  99     _space_counters->update_all(capacity, used);
 100     _heap_region_counters->update();
 101 
 102     MetaspaceCounters::update_performance_counters();
 103     CompressedClassSpaceCounters::update_performance_counters();
 104   }
 105 }


  29 #include "gc/shenandoah/shenandoahHeap.hpp"
  30 #include "gc/shenandoah/shenandoahHeapRegionCounters.hpp"
  31 #include "memory/metaspaceCounters.hpp"
  32 #include "services/memoryService.hpp"
  33 
  34 class ShenandoahYoungGenerationCounters : public GenerationCounters {
  35 public:
  36   ShenandoahYoungGenerationCounters() :
  37           GenerationCounters("Young", 0, 0, 0, (size_t)0, (size_t)0) {};
  38 
  39   virtual void update_all() {
  40     // no update
  41   }
  42 };
  43 
  44 class ShenandoahGenerationCounters : public GenerationCounters {
  45 private:
  46   ShenandoahHeap* _heap;
  47 public:
  48   ShenandoahGenerationCounters(ShenandoahHeap* heap) :
  49           GenerationCounters("Heap", 1, 1, heap->initial_capacity(), heap->max_capacity(), heap->committed()),
  50           _heap(heap)
  51   {};
  52 
  53   virtual void update_all() {
  54     _current_size->set_value(_heap->committed());
  55   }
  56 };
  57 
  58 ShenandoahMonitoringSupport::ShenandoahMonitoringSupport(ShenandoahHeap* heap) :
  59         _partial_counters(NULL),
  60         _full_counters(NULL)
  61 {
  62   // Collection counters do not fit Shenandoah very well.
  63   // We record partial cycles as "young", and full cycles (including full STW GC) as "old".
  64   _partial_counters  = new CollectorCounters("Shenandoah partial", 0);
  65   _full_counters     = new CollectorCounters("Shenandoah full",    1);
  66 
  67   // We report young gen as unused.
  68   _young_counters = new ShenandoahYoungGenerationCounters();
  69   _heap_counters  = new ShenandoahGenerationCounters(heap);
  70   _space_counters = new HSpaceCounters(_heap_counters->name_space(), "Heap", 0, heap->max_capacity(), heap->initial_capacity());
  71 
  72   _heap_region_counters = new ShenandoahHeapRegionCounters();
  73 }
  74 


  77 }
  78 
  79 CollectorCounters* ShenandoahMonitoringSupport::full_stw_collection_counters() {
  80   return _full_counters;
  81 }
  82 
  83 CollectorCounters* ShenandoahMonitoringSupport::concurrent_collection_counters() {
  84   return _full_counters;
  85 }
  86 
  87 CollectorCounters* ShenandoahMonitoringSupport::partial_collection_counters() {
  88   return _partial_counters;
  89 }
  90 
  91 void ShenandoahMonitoringSupport::update_counters() {
  92   MemoryService::track_memory_usage();
  93 
  94   if (UsePerfData) {
  95     ShenandoahHeap* heap = ShenandoahHeap::heap();
  96     size_t used = heap->used();
  97     size_t capacity = heap->capacity();
  98     _heap_counters->update_all();
  99     _space_counters->update_all(capacity, used);
 100     _heap_region_counters->update();
 101 
 102     MetaspaceCounters::update_performance_counters();
 103     CompressedClassSpaceCounters::update_performance_counters();
 104   }
 105 }
< prev index next >