Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_verbose_old_events/VerboseEventGCEnd.cpp
5985 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2014 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
#include "VerboseEventGCEnd.hpp"
25
#include "GCExtensions.hpp"
26
#include "VerboseEventStream.hpp"
27
#include "VerboseManagerOld.hpp"
28
29
void
30
MM_VerboseEventGCEnd::initialize(void)
31
{
32
OMRPORT_ACCESS_FROM_OMRVMTHREAD(_omrThread);
33
_timeInMilliSeconds = omrtime_current_time_millis();
34
}
35
36
37
/**
38
* Output common data for the every GC start event. This method is expected
39
* be to invoked by subclasses from their formattedOutput routines
40
*
41
* @param agent Pointer to an output agent.
42
*/
43
void
44
MM_VerboseEventGCEnd::gcEndFormattedOutput(MM_VerboseOutputAgent *agent)
45
{
46
UDATA indentLevel = _manager->getIndentLevel();
47
48
if(static_cast<J9VMThread*>(_omrThread->_language_vmthread)->javaVM->memoryManagerFunctions->j9gc_scavenger_enabled(static_cast<J9VMThread*>(_omrThread->_language_vmthread)->javaVM)) {
49
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<nursery freebytes=\"%zu\" totalbytes=\"%zu\" percent=\"%zu\" />",
50
_gcEndData.commonData.nurseryFreeBytes,
51
_gcEndData.commonData.nurseryTotalBytes,
52
(UDATA) ( ( (U_64) _gcEndData.commonData.nurseryFreeBytes * 100) / (U_64) _gcEndData.commonData.nurseryTotalBytes)
53
);
54
}
55
56
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<tenured freebytes=\"%zu\" totalbytes=\"%zu\" percent=\"%zu\" %s>",
57
_gcEndData.commonData.tenureFreeBytes,
58
_gcEndData.commonData.tenureTotalBytes,
59
(UDATA) ( ( (U_64) _gcEndData.commonData.tenureFreeBytes * 100) / (U_64) _gcEndData.commonData.tenureTotalBytes),
60
hasDetailedTenuredOutput() ? "" : "/"
61
);
62
63
if (hasDetailedTenuredOutput()) {
64
_manager->incrementIndent();
65
loaFormattedOutput(agent);
66
//tlhFormattedOutput(agent);
67
_manager->decrementIndent();
68
69
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</tenured>");
70
}
71
72
if(_extensions->verboseExtensions) {
73
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<rememberedset count=\"%zu\" />",
74
_gcEndData.commonData.rememberedSetCount
75
);
76
}
77
}
78
79
/**
80
* Returns true if there are subclauses to the <tenured> clause, or
81
* false if the <tenured> clause can stand alone
82
*/
83
bool
84
MM_VerboseEventGCEnd::hasDetailedTenuredOutput()
85
{
86
/* if verbose extensions is on, then tlh and nontlh data will be output */
87
if (_extensions->verboseExtensions) {
88
return true;
89
}
90
91
#if defined(J9VM_GC_LARGE_OBJECT_AREA)
92
if (_gcEndData.commonData.loaEnabled) {
93
return true;
94
}
95
#endif /* J9VM_GC_LARGE_OBJECT_AREA */
96
97
return false;
98
}
99
100
/**
101
* Output details about LOA and SOA spaces for the <tenured> clause.
102
* This output is only enabled if LOAs are enabled
103
*/
104
void
105
MM_VerboseEventGCEnd::loaFormattedOutput(MM_VerboseOutputAgent *agent)
106
{
107
#if defined(J9VM_GC_LARGE_OBJECT_AREA)
108
if (_gcEndData.commonData.loaEnabled) {
109
UDATA indentLevel = _manager->getIndentLevel();
110
UDATA tenureSOATotalBytes = _gcEndData.commonData.tenureTotalBytes - _gcEndData.commonData.tenureLOATotalBytes;
111
UDATA tenureSOAFreeBytes = _gcEndData.commonData.tenureFreeBytes - _gcEndData.commonData.tenureLOAFreeBytes;
112
113
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<soa freebytes=\"%zu\" totalbytes=\"%zu\" percent=\"%zu\" />",
114
tenureSOAFreeBytes,
115
tenureSOATotalBytes,
116
(UDATA) ( ( (U_64) tenureSOAFreeBytes * 100) / (U_64) tenureSOATotalBytes)
117
);
118
119
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<loa freebytes=\"%zu\" totalbytes=\"%zu\" percent=\"%zu\" />",
120
_gcEndData.commonData.tenureLOAFreeBytes,
121
_gcEndData.commonData.tenureLOATotalBytes,
122
( _gcEndData.commonData.tenureLOATotalBytes == 0 ? 0 : (UDATA) ( ( (U_64) _gcEndData.commonData.tenureLOAFreeBytes * 100) / (U_64) _gcEndData.commonData.tenureLOATotalBytes))
123
);
124
}
125
#endif /* J9VM_GC_LARGE_OBJECT_AREA*/
126
}
127
128