< 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

@@ -52,55 +52,71 @@
 public:
   ShenandoahGCSession(GCCause::Cause cause);
   ~ShenandoahGCSession();
 };
 
-class ShenandoahPausePhase : public StackObj {
+/*
+ * ShenandoahGCPhaseTiming tracks Shenandoah specific timing information
+ * of a GC phase
+ */
+class ShenandoahTimingsTracker : public StackObj {
 private:
-  GCTraceTimeWrapper<LogLevel::Info, LOG_TAGS(gc)> _tracer;
-  ConcurrentGCTimer* const _timer;
+  static ShenandoahPhaseTimings::Phase  _current_phase;
+
+  ShenandoahPhaseTimings* const         _timings;
+  const ShenandoahPhaseTimings::Phase   _phase;
+  ShenandoahPhaseTimings::Phase         _parent_phase;
+  double _start;
 
 public:
-  ShenandoahPausePhase(const char* title, bool log_heap_usage = false);
-  ~ShenandoahPausePhase();
+  ShenandoahTimingsTracker(ShenandoahPhaseTimings::Phase phase);
+  ~ShenandoahTimingsTracker();
+
+  static ShenandoahPhaseTimings::Phase current_phase() { return _current_phase; }
+
+  static bool is_current_phase_valid();
 };
 
-class ShenandoahConcurrentPhase : public StackObj {
+/*
+ * ShenandoahPausePhase tracks a STW pause and emits Shenandoah timing and
+ * a corresponding JFR event
+ */
+class ShenandoahPausePhase : public ShenandoahTimingsTracker {
 private:
   GCTraceTimeWrapper<LogLevel::Info, LOG_TAGS(gc)> _tracer;
   ConcurrentGCTimer* const _timer;
 
 public:
-  ShenandoahConcurrentPhase(const char* title, bool log_heap_usage = false);
-  ~ShenandoahConcurrentPhase();
+  ShenandoahPausePhase(const char* title, ShenandoahPhaseTimings::Phase phase, bool log_heap_usage = false);
+  ~ShenandoahPausePhase();
 };
 
-class ShenandoahGCPhase : public StackObj {
+/*
+ * ShenandoahConcurrentPhase tracks a concurrent GC phase and emits Shenandoah timing and
+ * a corresponding JFR event
+ */
+class ShenandoahConcurrentPhase : public ShenandoahTimingsTracker {
 private:
-  static ShenandoahPhaseTimings::Phase  _current_phase;
-
-  ShenandoahPhaseTimings* const         _timings;
-  const ShenandoahPhaseTimings::Phase   _phase;
-  ShenandoahPhaseTimings::Phase         _parent_phase;
-  double _start;
+  GCTraceTimeWrapper<LogLevel::Info, LOG_TAGS(gc)> _tracer;
+  ConcurrentGCTimer* const _timer;
 
 public:
-  ShenandoahGCPhase(ShenandoahPhaseTimings::Phase phase);
-  ~ShenandoahGCPhase();
-
-  static ShenandoahPhaseTimings::Phase current_phase() { return _current_phase; }
-
-  static bool is_current_phase_valid();
+  ShenandoahConcurrentPhase(const char* title, ShenandoahPhaseTimings::Phase phase, bool log_heap_usage = false);
+  ~ShenandoahConcurrentPhase();
 };
 
-class ShenandoahGCSubPhase: public ShenandoahGCPhase {
+/*
+ * ShenandoahGCPhase tracks Shenandoah specific timing information
+ * and emits a corresponding JFR event of a GC phase
+ */
+class ShenandoahGCPhase : public ShenandoahTimingsTracker {
 private:
   ConcurrentGCTimer* const _timer;
 
 public:
-  ShenandoahGCSubPhase(ShenandoahPhaseTimings::Phase phase);
-  ~ShenandoahGCSubPhase();
+  ShenandoahGCPhase(ShenandoahPhaseTimings::Phase phase);
+  ~ShenandoahGCPhase();
 };
 
 class ShenandoahGCWorkerPhase : public StackObj {
 private:
   ShenandoahPhaseTimings* const       _timings;
< prev index next >