Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_stats/MarkVLHGCStats.hpp
5986 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2021 IBM Corp. and others
4
*
5
* This program and the accompanying materials are made available under
6
* the terms of the Eclipse Public License 2.0 which accompanies this
7
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
* or the Apache License, Version 2.0 which accompanies this distribution and
9
* is available at https://www.apache.org/licenses/LICENSE-2.0.
10
*
11
* This Source Code may also be made available under the following
12
* Secondary Licenses when the conditions for such availability set
13
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
* General Public License, version 2 with the GNU Classpath
15
* Exception [1] and GNU General Public License, version 2 with the
16
* OpenJDK Assembly Exception [2].
17
*
18
* [1] https://www.gnu.org/software/classpath/license.html
19
* [2] http://openjdk.java.net/legal/assembly-exception.html
20
*
21
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
22
*******************************************************************************/
23
24
/**
25
* @file
26
* @ingroup GC_Stats
27
*/
28
29
#if !defined(MARKVLHGCSTATS_HPP_)
30
#define MARKVLHGCSTATS_HPP_
31
32
#include "j9.h"
33
#include "j9cfg.h"
34
#include "j9port.h"
35
#include "j9consts.h"
36
#include "modron.h"
37
#include "modronopt.h"
38
39
#if defined(J9VM_GC_VLHGC)
40
41
#include "MarkVLHGCStatsCore.hpp"
42
#include "Base.hpp"
43
#include "AtomicOperations.hpp"
44
#include "ReferenceStats.hpp"
45
46
/**
47
* Storage for statistics relevant to the mark phase of a global collection.
48
* @ingroup GC_Stats
49
*/
50
class MM_MarkVLHGCStats : public MM_MarkVLHGCStatsCore
51
{
52
/* data members */
53
private:
54
protected:
55
public:
56
57
UDATA _unfinalizedCandidates; /**< unfinalized objects that are candidates to be finalized visited this cycle */
58
UDATA _unfinalizedEnqueued; /**< unfinalized objects that are enqueued during this cycle (MUST be less than or equal _unfinalizedCandidates) */
59
60
UDATA _ownableSynchronizerCandidates; /**< number of ownable synchronizer objects visited this cycle, used by both MarkingScheme */
61
UDATA _ownableSynchronizerSurvived; /**< number of ownable synchronizer objects survived this cycle, used only by PMS */
62
UDATA _ownableSynchronizerCleared; /**< number of ownable synchronizer objects cleared this cycle, used only by GMP */
63
64
MM_ReferenceStats _weakReferenceStats; /**< Weak reference stats for the cycle */
65
MM_ReferenceStats _softReferenceStats; /**< Soft reference stats for the cycle */
66
MM_ReferenceStats _phantomReferenceStats; /**< Phantom reference stats for the cycle */
67
68
UDATA _stringConstantsCleared; /**< The number of string constants that have been cleared during marking */
69
UDATA _stringConstantsCandidates; /**< The number of string constants that have been visited in string table during marking */
70
71
UDATA _monitorReferenceCleared; /**< The number of monitor references that have been cleared during marking */
72
UDATA _monitorReferenceCandidates; /**< The number of monitor references that have been visited in monitor table during marking */
73
74
#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)
75
UDATA _doubleMappedArrayletsCleared; /**< The number of double mapped arraylets that have been cleared durign marking */
76
UDATA _doubleMappedArrayletsCandidates; /**< The number of double mapped arraylets that have been visited during marking */
77
#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */
78
79
#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)
80
UDATA _splitArraysProcessed; /**< The number of array chunks (not counting parts smaller than the split size) processed by this thread */
81
#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */
82
83
U_64 _concurrentGCThreadsCPUStartTimeSum; /**< The sum of all gc cpu thread times when concurrent gc work began */
84
U_64 _concurrentGCThreadsCPUEndTimeSum; /**< The sum of all gc cpu thread times when concurrent gc work ended */
85
U_64 _concurrentMarkGCThreadsTotalWorkTime; /**< The slowdown attributed to concurrent GC work */
86
/* function members */
87
private:
88
protected:
89
public:
90
91
void clear()
92
{
93
MM_MarkVLHGCStatsCore::clear();
94
_unfinalizedCandidates = 0;
95
_unfinalizedEnqueued = 0;
96
97
_ownableSynchronizerCandidates = 0;
98
_ownableSynchronizerSurvived = 0;
99
_ownableSynchronizerCleared = 0;
100
101
_weakReferenceStats.clear();
102
_softReferenceStats.clear();
103
_phantomReferenceStats.clear();
104
105
_stringConstantsCleared = 0;
106
_stringConstantsCandidates = 0;
107
108
_monitorReferenceCleared = 0;
109
_monitorReferenceCandidates = 0;
110
111
#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)
112
_doubleMappedArrayletsCleared = 0;
113
_doubleMappedArrayletsCandidates = 0;
114
#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */
115
116
#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)
117
_splitArraysProcessed = 0;
118
#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */
119
120
_concurrentGCThreadsCPUStartTimeSum = 0;
121
_concurrentGCThreadsCPUEndTimeSum = 0;
122
_concurrentMarkGCThreadsTotalWorkTime = 0;
123
124
}
125
126
void merge(MM_MarkVLHGCStats *statsToMerge)
127
{
128
MM_MarkVLHGCStatsCore::merge(statsToMerge);
129
_unfinalizedCandidates += statsToMerge->_unfinalizedCandidates;
130
_unfinalizedEnqueued += statsToMerge->_unfinalizedEnqueued;
131
132
_ownableSynchronizerCandidates += statsToMerge->_ownableSynchronizerCandidates;
133
_ownableSynchronizerSurvived += statsToMerge->_ownableSynchronizerSurvived;
134
_ownableSynchronizerCleared += statsToMerge->_ownableSynchronizerCleared;
135
136
_weakReferenceStats.merge(&statsToMerge->_weakReferenceStats);
137
_softReferenceStats.merge(&statsToMerge->_softReferenceStats);
138
_phantomReferenceStats.merge(&statsToMerge->_phantomReferenceStats);
139
140
_stringConstantsCleared += statsToMerge->_stringConstantsCleared;
141
_stringConstantsCandidates += statsToMerge->_stringConstantsCandidates;
142
143
_monitorReferenceCleared += statsToMerge->_monitorReferenceCleared;
144
_monitorReferenceCandidates += statsToMerge->_monitorReferenceCandidates;
145
146
#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)
147
_doubleMappedArrayletsCleared += statsToMerge->_doubleMappedArrayletsCleared;
148
_doubleMappedArrayletsCandidates += statsToMerge->_doubleMappedArrayletsCandidates;
149
#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */
150
151
_concurrentGCThreadsCPUStartTimeSum += statsToMerge->_concurrentGCThreadsCPUStartTimeSum;
152
_concurrentGCThreadsCPUEndTimeSum += statsToMerge->_concurrentGCThreadsCPUEndTimeSum;
153
_concurrentMarkGCThreadsTotalWorkTime += statsToMerge->_concurrentMarkGCThreadsTotalWorkTime;
154
155
#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)
156
/* It may not ever be useful to merge these stats, but do it anyways */
157
_splitArraysProcessed += statsToMerge->_splitArraysProcessed;
158
#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */
159
}
160
161
MM_MarkVLHGCStats() :
162
MM_MarkVLHGCStatsCore()
163
,_unfinalizedCandidates(0)
164
,_unfinalizedEnqueued(0)
165
,_ownableSynchronizerCandidates(0)
166
,_ownableSynchronizerSurvived(0)
167
,_ownableSynchronizerCleared(0)
168
,_weakReferenceStats()
169
,_softReferenceStats()
170
,_phantomReferenceStats()
171
,_stringConstantsCleared(0)
172
,_stringConstantsCandidates(0)
173
,_monitorReferenceCleared(0)
174
,_monitorReferenceCandidates(0)
175
#if defined(J9VM_GC_ENABLE_DOUBLE_MAP)
176
,_doubleMappedArrayletsCleared(0)
177
,_doubleMappedArrayletsCandidates(0)
178
#endif /* J9VM_GC_ENABLE_DOUBLE_MAP */
179
#if defined(J9MODRON_TGC_PARALLEL_STATISTICS)
180
,_splitArraysProcessed(0)
181
#endif /* J9MODRON_TGC_PARALLEL_STATISTICS */
182
,_concurrentGCThreadsCPUStartTimeSum(0)
183
,_concurrentGCThreadsCPUEndTimeSum(0)
184
,_concurrentMarkGCThreadsTotalWorkTime(0)
185
{
186
}
187
188
};
189
190
#endif /* J9VM_GC_VLHGC */
191
#endif /* MARKVLHGCSTATS_HPP_ */
192
193