Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_verbose_old_events/VerboseEventGCInitialized.cpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* 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
21
*******************************************************************************/
22
23
#include "VerboseEventGCInitialized.hpp"
24
#include "GCExtensions.hpp"
25
#include "VerboseEventStream.hpp"
26
#include "VerboseManagerOld.hpp"
27
28
#include "j9modron.h"
29
#include "omrutil.h"
30
31
/**
32
* Create an new instance of a MM_VerboseEventGCInitialized event.
33
* @param event Pointer to a structure containing the data passed over the hookInterface
34
*/
35
MM_VerboseEvent *
36
MM_VerboseEventGCInitialized::newInstance(MM_InitializedEvent *event, J9HookInterface** hookInterface)
37
{
38
MM_VerboseEventGCInitialized *eventObject;
39
40
eventObject = (MM_VerboseEventGCInitialized *)MM_VerboseEvent::create(event->currentThread, sizeof(MM_VerboseEventGCInitialized));
41
if(NULL != eventObject) {
42
new(eventObject) MM_VerboseEventGCInitialized(event, hookInterface);
43
}
44
return eventObject;
45
}
46
47
/**
48
* Populate events data fields.
49
* The event calls the event stream requesting the address of events it is interested in.
50
* When an address is returned it populates itself with the data.
51
*/
52
void
53
MM_VerboseEventGCInitialized::consumeEvents(void)
54
{
55
}
56
57
/**
58
* Passes a format string and data to the output routine defined in the passed output agent.
59
* @param agent Pointer to an output agent.
60
*/
61
void
62
MM_VerboseEventGCInitialized::formattedOutput(MM_VerboseOutputAgent *agent)
63
{
64
OMRPORT_ACCESS_FROM_OMRVMTHREAD(_omrThread);
65
UDATA indentLevel = _manager->getIndentLevel();
66
char timestamp[32];
67
jint i;
68
JavaVMInitArgs* vmArgs = static_cast<J9VMThread*>(_omrThread->_language_vmthread)->javaVM->vmArgsArray->actualVMArgs;
69
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(_omrThread->_vm);
70
71
omrstr_ftime(timestamp, sizeof(timestamp), VERBOSEGC_DATE_FORMAT, omrtime_current_time_millis());
72
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<initialized timestamp=\"%s\" >", timestamp);
73
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"gcPolicy\" value=\"%s\" />", _event.gcPolicy);
74
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"maxHeapSize\" value=\"0x%zx\" />", _event.maxHeapSize);
75
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"initialHeapSize\" value=\"0x%zx\" />", _event.initialHeapSize);
76
#if defined(OMR_GC_COMPRESSED_POINTERS)
77
if (OMRVMTHREAD_COMPRESS_OBJECT_REFERENCES(_omrThread)) {
78
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"compressedRefs\" value=\"true\" />");
79
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"compressedRefsDisplacement\" value=\"0x%zx\" />", 0);
80
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"compressedRefsShift\" value=\"0x%zx\" />", _event.compressedPointersShift);
81
} else
82
#endif /* defined(OMR_GC_COMPRESSED_POINTERS) */
83
{
84
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"compressedRefs\" value=\"false\" />");
85
}
86
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"pageSize\" value=\"0x%zx\" />", _event.heapPageSize);
87
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"pageType\" value=\"%s\" />", _event.heapPageType);
88
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"requestedPageSize\" value=\"0x%zx\" />", _event.heapRequestedPageSize);
89
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"requestedPageType\" value=\"%s\" />", _event.heapRequestedPageType);
90
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"gcthreads\" value=\"%zu\" />", _event.gcThreads);
91
92
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<system>");
93
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"physicalMemory\" value=\"%llu\" />", _event.physicalMemory);
94
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"numCPUs\" value=\"%zu\" />", _event.numCPUs);
95
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"architecture\" value=\"%s\" />", _event.architecture);
96
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"os\" value=\"%s\" />", _event.os);
97
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"osVersion\" value=\"%s\" />", _event.osVersion);
98
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "</system>");
99
100
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<vmargs>");
101
for (i = 0; i < vmArgs->nOptions; ++i) {
102
char escapedXMLString[128];
103
UDATA optLen = strlen(vmArgs->options[i].optionString);
104
UDATA escapeConsumed = escapeXMLString(OMRPORTLIB, escapedXMLString, sizeof(escapedXMLString), vmArgs->options[i].optionString, optLen);
105
const char* dots = (escapeConsumed < optLen) ? "..." : "";
106
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<vmarg name=\"%s%s\" value=\"0x%p\" />", escapedXMLString, dots, vmArgs->options[i].extraInfo);
107
}
108
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "</vmargs>");
109
110
if (extensions->isMetronomeGC()) {
111
#if defined(J9VM_GC_REALTIME)
112
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<metronome>");
113
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"beatsPerMeasure\" value=\"%zu\" />", _event.beat);
114
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"timeInterval\" value=\"%zu\" />", _event.timeWindow);
115
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"targetUtilization\" value=\"%zu\" />", _event.targetUtilization);
116
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"trigger\" value=\"0x%zx\" />", _event.gcTrigger);
117
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 2, "<attribute name=\"headRoom\" value=\"0x%zx\" />", _event.headRoom);
118
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "</metronome>");
119
#endif /* J9VM_GC_REALTIME */
120
}
121
122
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel + 1, "<attribute name=\"numaNodes\" value=\"%zu\" />", _event.numaNodes);
123
124
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</initialized>");
125
_manager->setInitializedTime(getTimeStamp());
126
agent->endOfCycle(static_cast<J9VMThread*>(_omrThread->_language_vmthread));
127
}
128
129