Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_verbose_old_events/VerboseEventAFEnd.cpp
5985 views
1
2
3
/*******************************************************************************
4
* Copyright (c) 1991, 2014 IBM Corp. and others
5
*
6
* This program and the accompanying materials are made available under
7
* the terms of the Eclipse Public License 2.0 which accompanies this
8
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
9
* or the Apache License, Version 2.0 which accompanies this distribution and
10
* is available at https://www.apache.org/licenses/LICENSE-2.0.
11
*
12
* This Source Code may also be made available under the following
13
* Secondary Licenses when the conditions for such availability set
14
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
15
* General Public License, version 2 with the GNU Classpath
16
* Exception [1] and GNU General Public License, version 2 with the
17
* OpenJDK Assembly Exception [2].
18
*
19
* [1] https://www.gnu.org/software/classpath/license.html
20
* [2] http://openjdk.java.net/legal/assembly-exception.html
21
*
22
* 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
23
*******************************************************************************/
24
25
#include "VerboseEventAFEnd.hpp"
26
#include "GCExtensions.hpp"
27
#include "VerboseEventStream.hpp"
28
#include "VerboseManagerOld.hpp"
29
#include "VerboseEventAFStart.hpp"
30
31
/**
32
* Create an new instance of a MM_Verbose_AF_End event.
33
* @param event Pointer to a structure containing the data passed over the hookInterface
34
*/
35
MM_VerboseEvent *
36
MM_VerboseEventAFEnd::newInstance(MM_AllocationFailureEndEvent *event, J9HookInterface** hookInterface)
37
{
38
MM_VerboseEventAFEnd *eventObject;
39
40
eventObject = (MM_VerboseEventAFEnd *)MM_VerboseEvent::create(event->currentThread, sizeof(MM_VerboseEventAFEnd));
41
if(NULL != eventObject) {
42
new(eventObject) MM_VerboseEventAFEnd(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_VerboseEventAFEnd::consumeEvents(void)
54
{
55
MM_VerboseEventStream *eventStream = _manager->getEventStream();
56
MM_VerboseEventAFStart *event = NULL;
57
58
if (NULL != (event = (MM_VerboseEventAFStart *)eventStream->returnEvent(J9HOOK_MM_PRIVATE_ALLOCATION_FAILURE_START, _manager->getPrivateHookInterface(), (MM_VerboseEvent *)this))){
59
_AFStartTime = event->getTimeStamp();
60
} else {
61
//Stream is corrupted, what now?
62
}
63
64
/* Set last AF time */
65
(MEMORY_TYPE_NEW == event->getSubSpaceType()) ? (_manager->setLastNurseryAFTime(_time)) : (_manager->setLastTenureAFTime(_time));
66
}
67
68
/**
69
* Passes a format string and data to the output routine defined in the passed output agent.
70
* @param agent Pointer to an output agent.
71
*/
72
void
73
MM_VerboseEventAFEnd::formattedOutput(MM_VerboseOutputAgent *agent)
74
{
75
UDATA indentLevel = _manager->getIndentLevel();
76
U_64 timeInMicroSeconds;
77
78
/* output the common GC start info */
79
gcEndFormattedOutput(agent);
80
81
if (!getTimeDeltaInMicroSeconds(&timeInMicroSeconds, _AFStartTime, _time + _exclusiveAccessTime)) {
82
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<warning details=\"clock error detected in time totalms\" />");
83
}
84
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "<time totalms=\"%llu.%03.3llu\" />",
85
timeInMicroSeconds / 1000,
86
timeInMicroSeconds % 1000
87
);
88
89
_manager->decrementIndent();
90
indentLevel = _manager->getIndentLevel();
91
92
agent->formatAndOutput(static_cast<J9VMThread*>(_omrThread->_language_vmthread), indentLevel, "</af>");
93
agent->endOfCycle(static_cast<J9VMThread*>(_omrThread->_language_vmthread));
94
}
95
96