Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_trace_vlhgc/TgcWriteOnceCompactTiming.cpp
5986 views
1
2
/*******************************************************************************
3
* Copyright (c) 1991, 2020 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 "j9.h"
25
#include "j9cfg.h"
26
#include "j9port.h"
27
#include "Tgc.hpp"
28
#include "mmhook.h"
29
30
#include <string.h>
31
32
#if defined(J9VM_GC_MODRON_COMPACTION)
33
34
#include "Base.hpp"
35
#include "CollectionSetDelegate.hpp"
36
#include "EnvironmentVLHGC.hpp"
37
#include "GCExtensions.hpp"
38
#include "TgcExtensions.hpp"
39
#include "HeapRegionIteratorVLHGC.hpp"
40
#include "HeapRegionDescriptorVLHGC.hpp"
41
#include "VMThreadListIterator.hpp"
42
43
static void
44
tgcHookCompactEndWriteOnceCompactTiming(J9HookInterface** hook, UDATA eventNum, void* eventData, void* userData)
45
{
46
MM_CompactEndEvent* event = (MM_CompactEndEvent*)eventData;
47
OMR_VMThread *omrVMThread = event->omrVMThread;
48
J9VMThread *vmThread = (J9VMThread *)MM_EnvironmentBase::getEnvironment(omrVMThread)->getLanguageVMThread();
49
MM_TgcExtensions *tgcExtensions = MM_TgcExtensions::getExtensions(vmThread);
50
PORT_ACCESS_FROM_VMC(vmThread);
51
52
tgcExtensions->printf("WriteOnceCompact timing details (times in microseconds):\nThread flush leaftag datainit clearmap remsetclear planning reportmove move ( stall) fixuppacket fixupleaf fixuproots recyclebits rebuild ( stall) clearmap rebuildnext\n");
53
54
J9VMThread *walkThread = NULL;
55
GC_VMThreadListIterator markThreadListIterator(vmThread);
56
while ((walkThread = markThreadListIterator.nextVMThread()) != NULL) {
57
MM_EnvironmentVLHGC *env = (MM_EnvironmentVLHGC*)walkThread->gcExtensions;
58
if ((walkThread == vmThread) || (env->getThreadType() == GC_WORKER_THREAD)) {
59
tgcExtensions->printf("%5zu: %5llu %7llu %8llu %8llu %11llu %8llu %8llu (%8llu) %11llu %9llu %10llu %11llu", env->getWorkerID(),
60
j9time_hires_delta(env->_compactVLHGCStats._flushStartTime, env->_compactVLHGCStats._flushEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
61
j9time_hires_delta(env->_compactVLHGCStats._leafTaggingStartTime, env->_compactVLHGCStats._leafTaggingEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
62
j9time_hires_delta(env->_compactVLHGCStats._regionCompactDataInitStartTime, env->_compactVLHGCStats._regionCompactDataInitEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
63
j9time_hires_delta(env->_compactVLHGCStats._clearMarkMapStartTime, env->_compactVLHGCStats._clearMarkMapEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
64
j9time_hires_delta(env->_compactVLHGCStats._rememberedSetClearingStartTime, env->_compactVLHGCStats._rememberedSetClearingEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
65
j9time_hires_delta(env->_compactVLHGCStats._planningStartTime, env->_compactVLHGCStats._planningEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
66
j9time_hires_delta(env->_compactVLHGCStats._moveStartTime, env->_compactVLHGCStats._moveEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
67
j9time_hires_delta(0, env->_compactVLHGCStats._moveStallTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
68
j9time_hires_delta(env->_compactVLHGCStats._fixupExternalPacketsStartTime, env->_compactVLHGCStats._fixupExternalPacketsEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
69
j9time_hires_delta(env->_compactVLHGCStats._fixupArrayletLeafStartTime, env->_compactVLHGCStats._fixupArrayletLeafEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
70
j9time_hires_delta(env->_compactVLHGCStats._rootFixupStartTime, env->_compactVLHGCStats._rootFixupEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
71
j9time_hires_delta(env->_compactVLHGCStats._recycleStartTime, env->_compactVLHGCStats._recycleEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS)
72
);
73
tgcExtensions->printf(" %8llu (%8llu) %8llu %11llu\n",
74
j9time_hires_delta(env->_compactVLHGCStats._rebuildMarkBitsStartTime, env->_compactVLHGCStats._rebuildMarkBitsEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
75
j9time_hires_delta(0, env->_compactVLHGCStats._rebuildStallTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
76
j9time_hires_delta(env->_compactVLHGCStats._finalClearNextMarkMapStartTime, env->_compactVLHGCStats._finalClearNextMarkMapEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS),
77
j9time_hires_delta(env->_compactVLHGCStats._rebuildNextMarkMapStartTime, env->_compactVLHGCStats._rebuildNextMarkMapEndTime, J9PORT_TIME_DELTA_IN_MICROSECONDS)
78
);
79
80
}
81
}
82
}
83
84
/**
85
* Initialize write once compact timing tgc tracing.
86
* Attaches hooks to the appropriate functions handling events used by write once compact timing tgc tracing.
87
*/
88
bool
89
tgcWriteOnceCompactTimingInitialize(J9JavaVM *javaVM)
90
{
91
MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(javaVM);
92
bool result = true;
93
94
J9HookInterface** omrHooks = J9_HOOK_INTERFACE(extensions->omrHookInterface);
95
(*omrHooks)->J9HookRegisterWithCallSite(omrHooks, J9HOOK_MM_OMR_COMPACT_END, tgcHookCompactEndWriteOnceCompactTiming, OMR_GET_CALLSITE(), NULL);
96
97
return result;
98
}
99
#endif /* J9VM_GC_MODRON_COMPACTION */
100
101