< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahUtils.hpp

Print this page
rev 59188 : 8244243: Shenandoah: Cleanup Shenandoah phase timing tracking and JFR event supporting


  37 #include "memory/allocation.hpp"
  38 #include "runtime/safepoint.hpp"
  39 #include "runtime/vmThread.hpp"
  40 #include "runtime/vmOperations.hpp"
  41 #include "services/memoryService.hpp"
  42 
  43 class GCTimer;
  44 
  45 class ShenandoahGCSession : public StackObj {
  46 private:
  47   ShenandoahHeap* const _heap;
  48   GCTimer*  const _timer;
  49   GCTracer* const _tracer;
  50 
  51   TraceMemoryManagerStats _trace_cycle;
  52 public:
  53   ShenandoahGCSession(GCCause::Cause cause);
  54   ~ShenandoahGCSession();
  55 };
  56 
  57 class ShenandoahPausePhase : public StackObj {




  58 private:
  59   GCTraceTimeWrapper<LogLevel::Info, LOG_TAGS(gc)> _tracer;
  60   ConcurrentGCTimer* const _timer;




  61 
  62 public:
  63   ShenandoahPausePhase(const char* title, bool log_heap_usage = false);
  64   ~ShenandoahPausePhase();




  65 };
  66 
  67 class ShenandoahConcurrentPhase : public StackObj {




  68 private:
  69   GCTraceTimeWrapper<LogLevel::Info, LOG_TAGS(gc)> _tracer;
  70   ConcurrentGCTimer* const _timer;
  71 
  72 public:
  73   ShenandoahConcurrentPhase(const char* title, bool log_heap_usage = false);
  74   ~ShenandoahConcurrentPhase();
  75 };
  76 
  77 class ShenandoahGCPhase : public StackObj {




  78 private:
  79   static ShenandoahPhaseTimings::Phase  _current_phase;
  80 
  81   ShenandoahPhaseTimings* const         _timings;
  82   const ShenandoahPhaseTimings::Phase   _phase;
  83   ShenandoahPhaseTimings::Phase         _parent_phase;
  84   double _start;
  85 
  86 public:
  87   ShenandoahGCPhase(ShenandoahPhaseTimings::Phase phase);
  88   ~ShenandoahGCPhase();
  89 
  90   static ShenandoahPhaseTimings::Phase current_phase() { return _current_phase; }
  91 
  92   static bool is_current_phase_valid();
  93 };
  94 
  95 class ShenandoahGCSubPhase: public ShenandoahGCPhase {




  96 private:
  97   ConcurrentGCTimer* const _timer;
  98 
  99 public:
 100   ShenandoahGCSubPhase(ShenandoahPhaseTimings::Phase phase);
 101   ~ShenandoahGCSubPhase();
 102 };
 103 
 104 class ShenandoahGCWorkerPhase : public StackObj {
 105 private:
 106   ShenandoahPhaseTimings* const       _timings;
 107   const ShenandoahPhaseTimings::Phase _phase;
 108 public:
 109   ShenandoahGCWorkerPhase(ShenandoahPhaseTimings::Phase phase);
 110   ~ShenandoahGCWorkerPhase();
 111 };
 112 
 113 // Aggregates all the things that should happen before/after the pause.
 114 class ShenandoahGCPauseMark : public StackObj {
 115 private:
 116   ShenandoahHeap* const _heap;
 117   const GCIdMark                _gc_id_mark;
 118   const SvcGCMarker             _svc_gc_mark;
 119   const IsGCActiveMark          _is_gc_active_mark;
 120   TraceMemoryManagerStats       _trace_pause;
 121 




  37 #include "memory/allocation.hpp"
  38 #include "runtime/safepoint.hpp"
  39 #include "runtime/vmThread.hpp"
  40 #include "runtime/vmOperations.hpp"
  41 #include "services/memoryService.hpp"
  42 
  43 class GCTimer;
  44 
  45 class ShenandoahGCSession : public StackObj {
  46 private:
  47   ShenandoahHeap* const _heap;
  48   GCTimer*  const _timer;
  49   GCTracer* const _tracer;
  50 
  51   TraceMemoryManagerStats _trace_cycle;
  52 public:
  53   ShenandoahGCSession(GCCause::Cause cause);
  54   ~ShenandoahGCSession();
  55 };
  56 
  57 /*
  58  * ShenandoahGCPhaseTiming tracks Shenandoah specific timing information
  59  * of a GC phase
  60  */
  61 class ShenandoahTimingsTracker : public StackObj {
  62 private:
  63   static ShenandoahPhaseTimings::Phase  _current_phase;
  64 
  65   ShenandoahPhaseTimings* const         _timings;
  66   const ShenandoahPhaseTimings::Phase   _phase;
  67   ShenandoahPhaseTimings::Phase         _parent_phase;
  68   double _start;
  69 
  70 public:
  71   ShenandoahTimingsTracker(ShenandoahPhaseTimings::Phase phase);
  72   ~ShenandoahTimingsTracker();
  73 
  74   static ShenandoahPhaseTimings::Phase current_phase() { return _current_phase; }
  75 
  76   static bool is_current_phase_valid();
  77 };
  78 
  79 /*
  80  * ShenandoahPausePhase tracks a STW pause and emits Shenandoah timing and
  81  * a corresponding JFR event
  82  */
  83 class ShenandoahPausePhase : public ShenandoahTimingsTracker {
  84 private:
  85   GCTraceTimeWrapper<LogLevel::Info, LOG_TAGS(gc)> _tracer;
  86   ConcurrentGCTimer* const _timer;
  87 
  88 public:
  89   ShenandoahPausePhase(const char* title, ShenandoahPhaseTimings::Phase phase, bool log_heap_usage = false);
  90   ~ShenandoahPausePhase();
  91 };
  92 
  93 /*
  94  * ShenandoahConcurrentPhase tracks a concurrent GC phase and emits Shenandoah timing and
  95  * a corresponding JFR event
  96  */
  97 class ShenandoahConcurrentPhase : public ShenandoahTimingsTracker {
  98 private:
  99   GCTraceTimeWrapper<LogLevel::Info, LOG_TAGS(gc)> _tracer;
 100   ConcurrentGCTimer* const _timer;




 101 
 102 public:
 103   ShenandoahConcurrentPhase(const char* title, ShenandoahPhaseTimings::Phase phase, bool log_heap_usage = false);
 104   ~ShenandoahConcurrentPhase();




 105 };
 106 
 107 /*
 108  * ShenandoahGCPhase tracks Shenandoah specific timing information
 109  * and emits a corresponding JFR event of a GC phase
 110  */
 111 class ShenandoahGCPhase : public ShenandoahTimingsTracker {
 112 private:
 113   ConcurrentGCTimer* const _timer;
 114 
 115 public:
 116   ShenandoahGCPhase(ShenandoahPhaseTimings::Phase phase);
 117   ~ShenandoahGCPhase();
 118 };
 119 
 120 class ShenandoahGCWorkerPhase : public StackObj {
 121 private:
 122   ShenandoahPhaseTimings* const       _timings;
 123   const ShenandoahPhaseTimings::Phase _phase;
 124 public:
 125   ShenandoahGCWorkerPhase(ShenandoahPhaseTimings::Phase phase);
 126   ~ShenandoahGCWorkerPhase();
 127 };
 128 
 129 // Aggregates all the things that should happen before/after the pause.
 130 class ShenandoahGCPauseMark : public StackObj {
 131 private:
 132   ShenandoahHeap* const _heap;
 133   const GCIdMark                _gc_id_mark;
 134   const SvcGCMarker             _svc_gc_mark;
 135   const IsGCActiveMark          _is_gc_active_mark;
 136   TraceMemoryManagerStats       _trace_pause;
 137 


< prev index next >