< prev index next >

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

Print this page

  1 /*
  2  * Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved.

  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 24 
 25 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHUTILS_HPP
 26 #define SHARE_GC_SHENANDOAH_SHENANDOAHUTILS_HPP
 27 
 28 #include "gc/shared/gcCause.hpp"
 29 #include "gc/shared/gcTraceTime.inline.hpp"
 30 #include "gc/shared/gcVMOperations.hpp"
 31 #include "gc/shared/isGCActiveMark.hpp"
 32 #include "gc/shared/suspendibleThreadSet.hpp"
 33 #include "gc/shared/workerThread.hpp"
 34 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
 35 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
 36 #include "jfr/jfrEvents.hpp"
 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 };

  1 /*
  2  * Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved.
  3  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *

 25 
 26 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHUTILS_HPP
 27 #define SHARE_GC_SHENANDOAH_SHENANDOAHUTILS_HPP
 28 
 29 #include "gc/shared/gcCause.hpp"
 30 #include "gc/shared/gcTraceTime.inline.hpp"
 31 #include "gc/shared/gcVMOperations.hpp"
 32 #include "gc/shared/isGCActiveMark.hpp"
 33 #include "gc/shared/suspendibleThreadSet.hpp"
 34 #include "gc/shared/workerThread.hpp"
 35 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
 36 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
 37 #include "jfr/jfrEvents.hpp"
 38 #include "memory/allocation.hpp"
 39 #include "runtime/safepoint.hpp"
 40 #include "runtime/vmThread.hpp"
 41 #include "runtime/vmOperations.hpp"
 42 #include "services/memoryService.hpp"
 43 
 44 class GCTimer;
 45 class ShenandoahGeneration;
 46 
 47 #define SHENANDOAH_RETURN_EVENT_MESSAGE(generation_type, prefix, postfix) \
 48   switch (generation_type) {                                              \
 49     case NON_GEN:                                                         \
 50       return prefix " (NON-GENERATIONAL)" postfix;                        \
 51     case GLOBAL:                                                          \
 52       return prefix " (GLOBAL)" postfix;                                  \
 53     case YOUNG:                                                           \
 54       return prefix " (YOUNG)" postfix;                                   \
 55     case OLD:                                                             \
 56       return prefix " (OLD)" postfix;                                     \
 57     default:                                                              \
 58       ShouldNotReachHere();                                               \
 59       return prefix " (UNKNOWN)" postfix;                                 \
 60   }                                                                       \
 61 
 62 class ShenandoahGCSession : public StackObj {
 63 private:
 64   ShenandoahHeap* const _heap;
 65   ShenandoahGeneration* const _generation;
 66   GCTimer*  const _timer;
 67   GCTracer* const _tracer;
 68 
 69   TraceMemoryManagerStats _trace_cycle;
 70 public:
 71   ShenandoahGCSession(GCCause::Cause cause, ShenandoahGeneration* generation);
 72   ~ShenandoahGCSession();
 73 };
 74 
 75 /*
 76  * ShenandoahGCPhaseTiming tracks Shenandoah specific timing information
 77  * of a GC phase
 78  */
 79 class ShenandoahTimingsTracker : public StackObj {
 80 private:
 81   static ShenandoahPhaseTimings::Phase  _current_phase;
 82 
 83   ShenandoahPhaseTimings* const         _timings;
 84   const ShenandoahPhaseTimings::Phase   _phase;
 85   const bool                            _should_aggregate;
 86   ShenandoahPhaseTimings::Phase         _parent_phase;
 87   double _start;
 88 
 89 public:
 90   ShenandoahTimingsTracker(ShenandoahPhaseTimings::Phase phase, bool should_aggregate = false);
 91   ~ShenandoahTimingsTracker();
 92 
 93   static ShenandoahPhaseTimings::Phase current_phase() { return _current_phase; }
 94 
 95   static bool is_current_phase_valid();
 96 };
 97 
 98 /*
 99  * ShenandoahPausePhase tracks a STW pause and emits Shenandoah timing and
100  * a corresponding JFR event
101  */
102 class ShenandoahPausePhase : public ShenandoahTimingsTracker {
103 private:
104   GCTraceTimeWrapper<LogLevel::Info, LOG_TAGS(gc)> _tracer;
105   ConcurrentGCTimer* const _timer;
106 
107 public:
108   ShenandoahPausePhase(const char* title, ShenandoahPhaseTimings::Phase phase, bool log_heap_usage = false);
109   ~ShenandoahPausePhase();
110 };
< prev index next >