Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/gc_verbose_old_events/VerboseEvent.hpp
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
#if !defined(VERBOSE_EVENT_HPP_)
25
#define VERBOSE_EVENT_HPP_
26
27
#include "j9.h"
28
#include "j9cfg.h"
29
#include "modron.h"
30
31
#include "Base.hpp"
32
#include "GCExtensions.hpp"
33
34
class MM_EnvironmentBase;
35
class MM_VerboseEventStream;
36
class MM_VerboseOutputAgent;
37
class MM_VerboseManagerOld;
38
39
/**
40
* Base class for MM_VerboseEvents.
41
* @ingroup GC_verbose_events
42
*/
43
class MM_VerboseEvent : public MM_Base
44
{
45
/*
46
* Data members
47
*/
48
private:
49
protected:
50
OMR_VMThread *_omrThread;
51
MM_GCExtensions *_extensions;
52
MM_VerboseManagerOld *_manager;
53
54
U_64 _time;
55
UDATA _type;
56
57
MM_VerboseEvent *_next;
58
MM_VerboseEvent *_previous;
59
60
J9HookInterface** _hookInterface; /* hook interface the event is registered with */
61
62
public:
63
64
/*
65
* Function members
66
*/
67
private:
68
protected:
69
public:
70
MMINLINE MM_VerboseEvent *getNextEvent() { return _next; }
71
MMINLINE MM_VerboseEvent *getPreviousEvent() { return _previous; }
72
73
MMINLINE void setNextEvent(MM_VerboseEvent *nextEvent) { _next = nextEvent; }
74
MMINLINE void setPreviousEvent(MM_VerboseEvent *previousEvent) { _previous = previousEvent; }
75
76
virtual bool definesOutputRoutine() = 0;
77
virtual bool endsEventChain() = 0;
78
79
virtual bool isAtomic() { return false; } /**< Override to return true if event should be handled away from main event stream */
80
81
MMINLINE OMR_VMThread* getThread() { return _omrThread; }
82
MMINLINE U_64 getTimeStamp() { return _time; }
83
MMINLINE UDATA getEventType() { return _type; }
84
MMINLINE J9HookInterface** getHookInterface() { return _hookInterface; }
85
86
MMINLINE bool getTimeDeltaInMicroSeconds(U_64 *timeInMicroSeconds, U_64 startTime, U_64 endTime)
87
{
88
if(endTime < startTime) {
89
*timeInMicroSeconds = 0;
90
return false;
91
}
92
OMRPORT_ACCESS_FROM_OMRVMTHREAD(_omrThread);
93
94
*timeInMicroSeconds = omrtime_hires_delta(startTime, endTime, J9PORT_TIME_DELTA_IN_MICROSECONDS);
95
return true;
96
}
97
98
static void *create(OMR_VMThread *omrVMThread, UDATA size);
99
static void *create(J9VMThread *vmThread, UDATA size);
100
virtual void kill(MM_EnvironmentBase *env);
101
102
virtual void consumeEvents() = 0;
103
virtual void formattedOutput(MM_VerboseOutputAgent *agent) = 0;
104
105
MM_VerboseEvent(OMR_VMThread *omrVMThread, U_64 timestamp, UDATA type, J9HookInterface** hookInterface)
106
: MM_Base()
107
, _omrThread(omrVMThread)
108
, _extensions(MM_GCExtensions::getExtensions(omrVMThread))
109
, _manager((MM_VerboseManagerOld*)_extensions->verboseGCManager)
110
, _time(timestamp)
111
, _type(type)
112
, _next(NULL)
113
, _previous(NULL)
114
, _hookInterface(hookInterface)
115
{}
116
};
117
118
#endif /* VERBOSE_EVENT_HPP_ */
119
120