Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/bcutil/ROMClassVerbosePhase.hpp
5985 views
1
/*******************************************************************************
2
* Copyright (c) 2001, 2017 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
24
#ifndef ROMCLASSVERBOSEPHASE_HPP_
25
#define ROMCLASSVERBOSEPHASE_HPP_
26
27
/* @ddr_namespace: default */
28
#include "BuildResult.hpp"
29
#include "ROMClassCreationContext.hpp"
30
#include "ROMClassCreationPhase.hpp"
31
32
/*
33
* ROMClassVerbosePhase is a helper class for -verbose:romclass reporting.
34
* Instances are intended to be stack allocated and their lifetimes correspond to phases of ROM class creation.
35
*/
36
class ROMClassVerbosePhase
37
{
38
public:
39
ROMClassVerbosePhase(ROMClassCreationContext *context, ROMClassCreationPhase phase) :
40
_context(context),
41
_phase(phase),
42
_result(NULL)
43
{
44
_context->recordPhaseStart(_phase);
45
}
46
47
ROMClassVerbosePhase(ROMClassCreationContext *context, ROMClassCreationPhase phase, BuildResult *result) :
48
_context(context),
49
_phase(phase),
50
_result(result)
51
{
52
_context->recordPhaseStart(_phase);
53
}
54
55
~ROMClassVerbosePhase()
56
{
57
_context->recordPhaseEnd(_phase, NULL == _result ? OK : *_result);
58
}
59
60
private:
61
ROMClassCreationContext *_context;
62
ROMClassCreationPhase _phase;
63
BuildResult *_result;
64
};
65
66
/*
67
* Set RECORD_HOT_PHASES to 1 to enable recording of hot verbose phases, for detailed
68
* ROM class performance analysis at the cost of extra overhead.
69
*/
70
#define RECORD_HOT_PHASES 0
71
72
#if RECORD_HOT_PHASES
73
#define ROMCLASS_VERBOSE_PHASE_HOT(context, phase) ROMClassVerbosePhase v(context, phase)
74
#else
75
#define ROMCLASS_VERBOSE_PHASE_HOT(context, phase)
76
#endif
77
78
#endif /* ROMCLASSVERBOSEPHASE_HPP_ */
79
80