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 const bool _should_aggregate;
68 ShenandoahPhaseTimings::Phase _parent_phase;
69 double _start;
70
71 public:
72 ShenandoahTimingsTracker(ShenandoahPhaseTimings::Phase phase, bool should_aggregate = false);
73 ~ShenandoahTimingsTracker();
|
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 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();
|