Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_verbose_old_events/VerboseEventConcurrentHalted.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 "ConcurrentGCStats.hpp"
25
#include "GCExtensions.hpp"
26
#include "ScanClassesMode.hpp"
27
#include "VerboseEventConcurrentHalted.hpp"
28
#include "VerboseEventStream.hpp"
29
#include "VerboseManagerOld.hpp"
30
31
#include "j9modron.h"
32
33
/**
34
* Create an new instance of a MM_VerboseEventConcurrentHalted event.
35
* @param event Pointer to a structure containing the data passed over the hookInterface
36
*/
37
MM_VerboseEvent *
38
MM_VerboseEventConcurrentHalted::newInstance(MM_ConcurrentHaltedEvent *event, J9HookInterface** hookInterface)
39
{
40
MM_VerboseEventConcurrentHalted *eventObject;
41
42
eventObject = (MM_VerboseEventConcurrentHalted *)MM_VerboseEvent::create(event->currentThread, sizeof(MM_VerboseEventConcurrentHalted));
43
if(NULL != eventObject) {
44
new(eventObject) MM_VerboseEventConcurrentHalted(event, hookInterface);
45
}
46
return eventObject;
47
}
48
49
/**
50
* Populate events data fields.
51
* The event calls the event stream requesting the address of events it is interested in.
52
* When an address is returned it populates itself with the data.
53
*/
54
void
55
MM_VerboseEventConcurrentHalted::consumeEvents(void)
56
{
57
}
58
59
/**
60
* Passes a format string and data to the output routine defined in the passed output agent.
61
* @param agent Pointer to an output agent.
62
*/
63
void
64
MM_VerboseEventConcurrentHalted::formattedOutput(MM_VerboseOutputAgent *agent)
65
{
66
UDATA indentLevel = _manager->getIndentLevel();
67
68
#define CONCURRENT_STATUS_BUFFER_LENGTH 32
69
char statusBuffer[CONCURRENT_STATUS_BUFFER_LENGTH];
70
MM_EnvironmentBase *env = MM_EnvironmentBase::getEnvironment(_omrThread);
71
const char* statusString = MM_ConcurrentGCStats::getConcurrentStatusString(env, _executionMode, statusBuffer, CONCURRENT_STATUS_BUFFER_LENGTH);
72
#undef CONCURRENT_STATUS_BUFFER_LENGTH
73
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<con event=\"halted\" mode=\"%s\" state=\"%s\">",
74
statusString, getConcurrentStateAsString(_isCardCleaningComplete, _scanClassesMode, _isTracingExhausted));
75
76
_manager->incrementIndent();
77
indentLevel = _manager->getIndentLevel();
78
79
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<stats tracetarget=\"%zu\">", _traceTarget);
80
81
_manager->incrementIndent();
82
indentLevel = _manager->getIndentLevel();
83
84
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<traced total=\"%zu\" mutators=\"%zu\" helpers=\"%zu\" percent=\"%zu\" />",
85
_tracedTotal,
86
_tracedByMutators,
87
_tracedByHelpers,
88
_traceTarget == 0 ? 0 : (UDATA) ( ( (U_64) _tracedTotal * 100) / (U_64) _traceTarget)
89
);
90
91
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<cards cleaned=\"%zu\" kickoff=\"%zu\" />",
92
_cardsCleaned,
93
_cardCleaningThreshold
94
);
95
96
if(_workStackOverflowOccured) {
97
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<warning details=\"concurrent work stack overflow\" count=\"%zu\" />", _workStackOverflowCount);
98
}
99
100
_manager->decrementIndent();
101
indentLevel = _manager->getIndentLevel();
102
103
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</stats>");
104
105
_manager->decrementIndent();
106
indentLevel = _manager->getIndentLevel();
107
108
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</con>");
109
}
110
111
/**
112
* Return the concurrent reason as a string
113
* @param isCardCleaningComplete Card cleaning complete condition
114
* @param scanClassesMode Current scan classes state
115
* $param isTracingExhausted Tracing complete condition
116
*/
117
const char *
118
MM_VerboseEventConcurrentHalted::getConcurrentStateAsString(UDATA isCardCleaningComplete, UDATA scanClassesMode, UDATA isTracingExhausted)
119
{
120
if (0 == isCardCleaningComplete) {
121
return "Card cleaning incomplete";
122
}
123
124
#if defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING)
125
switch (scanClassesMode) {
126
case MM_ScanClassesMode::SCAN_CLASSES_NEED_TO_BE_EXECUTED:
127
case MM_ScanClassesMode::SCAN_CLASSES_CURRENTLY_ACTIVE:
128
return "Class scanning incomplete";
129
case MM_ScanClassesMode::SCAN_CLASSES_COMPLETE:
130
case MM_ScanClassesMode::SCAN_CLASSES_DISABLED:
131
break;
132
default:
133
return "Class scanning bad state";
134
}
135
#endif /* defined(J9VM_GC_DYNAMIC_CLASS_UNLOADING) */
136
137
if (0 == isTracingExhausted) {
138
return "Tracing incomplete";
139
}
140
141
return "Complete";
142
}
143
144
145