-
Notifications
You must be signed in to change notification settings - Fork 105
/
logTag.hpp
221 lines (210 loc) · 6.35 KB
/
logTag.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_LOGGING_LOGTAG_HPP
#define SHARE_VM_LOGGING_LOGTAG_HPP
#include "logging/logTag_ext.hpp"
#include "memory/allocation.hpp"
#include "utilities/globalDefinitions.hpp"
// List of available logging tags. New tags should be added here.
// (The tags 'all', 'disable' and 'help' are special tags that can
// not be used in log calls, and should not be listed below.)
#define LOG_TAG_LIST \
LOG_TAG(add) \
LOG_TAG(age) \
LOG_TAG(alloc) \
LOG_TAG(aot) \
LOG_TAG(annotation) \
LOG_TAG(arguments) \
LOG_TAG(attach) \
LOG_TAG(barrier) \
LOG_TAG(biasedlocking) \
LOG_TAG(blocks) \
LOG_TAG(bot) \
LOG_TAG(breakpoint) \
LOG_TAG(bytecode) \
LOG_TAG(cds) \
LOG_TAG(census) \
LOG_TAG(class) \
LOG_TAG(classhisto) \
LOG_TAG(cleanup) \
LOG_TAG(codecache) \
LOG_TAG(compaction) \
LOG_TAG(compilation) \
LOG_TAG(constraints) \
LOG_TAG(constantpool) \
LOG_TAG(container) \
LOG_TAG(coops) \
LOG_TAG(cpu) \
LOG_TAG(cset) \
LOG_TAG(data) \
LOG_TAG(datacreation) \
LOG_TAG(dcmd) \
LOG_TAG(decoder) \
LOG_TAG(defaultmethods) \
LOG_TAG(director) \
LOG_TAG(dump) \
LOG_TAG(ergo) \
LOG_TAG(event) \
LOG_TAG(exceptions) \
LOG_TAG(exit) \
LOG_TAG(fingerprint) \
LOG_TAG(free) \
LOG_TAG(freelist) \
LOG_TAG(gc) \
LOG_TAG(handshake) \
LOG_TAG(hashtables) \
LOG_TAG(heap) \
LOG_TAG(humongous) \
LOG_TAG(ihop) \
LOG_TAG(iklass) \
LOG_TAG(init) \
LOG_TAG(inlining) \
LOG_TAG(interpreter) \
LOG_TAG(itables) \
LOG_TAG(jfr) \
LOG_TAG(jit) \
LOG_TAG(jni) \
LOG_TAG(jvmti) \
LOG_TAG(liveness) \
LOG_TAG(load) /* Trace all classes loaded */ \
LOG_TAG(loader) \
LOG_TAG(logging) \
LOG_TAG(malloc) \
LOG_TAG(mark) \
LOG_TAG(marking) \
LOG_TAG(membername) \
LOG_TAG(memops) \
LOG_TAG(methodcomparator) \
LOG_TAG(metadata) \
LOG_TAG(metaspace) \
LOG_TAG(mmu) \
LOG_TAG(module) \
LOG_TAG(monitorinflation) \
LOG_TAG(monitormismatch) \
LOG_TAG(nestmates) \
LOG_TAG(nmethod) \
LOG_TAG(normalize) \
LOG_TAG(objecttagging) \
LOG_TAG(obsolete) \
LOG_TAG(oldobject) \
LOG_TAG(oom) \
LOG_TAG(oopmap) \
LOG_TAG(oops) \
LOG_TAG(oopstorage) \
LOG_TAG(os) \
LOG_TAG(pagesize) \
LOG_TAG(patch) \
LOG_TAG(path) \
LOG_TAG(perf) \
LOG_TAG(phases) \
LOG_TAG(plab) \
LOG_TAG(preview) /* Trace loading of preview feature types */ \
LOG_TAG(promotion) \
LOG_TAG(preorder) /* Trace all classes loaded in order referenced (not loaded) */ \
LOG_TAG(protectiondomain) /* "Trace protection domain verification" */ \
LOG_TAG(ref) \
LOG_TAG(redefine) \
LOG_TAG(refine) \
LOG_TAG(region) \
LOG_TAG(reloc) \
LOG_TAG(remset) \
LOG_TAG(parser) \
LOG_TAG(purge) \
LOG_TAG(resolve) \
LOG_TAG(safepoint) \
LOG_TAG(sampling) \
LOG_TAG(scavenge) \
LOG_TAG(setting) \
LOG_TAG(smr) \
LOG_TAG(stacktrace) \
LOG_TAG(stackwalk) \
LOG_TAG(start) \
LOG_TAG(startuptime) \
LOG_TAG(state) \
LOG_TAG(stats) \
LOG_TAG(stringdedup) \
LOG_TAG(stringtable) \
LOG_TAG(stackmap) \
LOG_TAG(subclass) \
LOG_TAG(survivor) \
LOG_TAG(sweep) \
LOG_TAG(system) \
LOG_TAG(table) \
LOG_TAG(task) \
DEBUG_ONLY(LOG_TAG(test)) \
LOG_TAG(thread) \
LOG_TAG(tlab) \
LOG_TAG(time) \
LOG_TAG(timer) \
LOG_TAG(tracking) \
LOG_TAG(update) \
LOG_TAG(unload) /* Trace unloading of classes */ \
LOG_TAG(unshareable) \
LOG_TAG(mirror) \
LOG_TAG(verification) \
LOG_TAG(verify) \
LOG_TAG(vmoperation) \
LOG_TAG(vmthread) \
LOG_TAG(vtables) \
LOG_TAG(vtablestubs) \
LOG_TAG(workgang) \
LOG_TAG_LIST_EXT
#define PREFIX_LOG_TAG(T) (LogTag::_##T)
// Expand a set of log tags to their prefixed names.
// For error detection purposes, the macro passes one more tag than what is supported.
// If too many tags are given, a static assert in the log class will fail.
#define LOG_TAGS_EXPANDED(T0, T1, T2, T3, T4, T5, ...) PREFIX_LOG_TAG(T0), PREFIX_LOG_TAG(T1), PREFIX_LOG_TAG(T2), \
PREFIX_LOG_TAG(T3), PREFIX_LOG_TAG(T4), PREFIX_LOG_TAG(T5)
// The EXPAND_VARARGS macro is required for MSVC, or it will resolve the LOG_TAGS_EXPANDED macro incorrectly.
#define EXPAND_VARARGS(x) x
#define LOG_TAGS(...) EXPAND_VARARGS(LOG_TAGS_EXPANDED(__VA_ARGS__, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG, _NO_TAG))
// Log tags are used to classify log messages.
// Each log message can be assigned between 1 to LogTag::MaxTags number of tags.
// Specifying multiple tags for a log message means that only outputs configured
// for those exact tags, or a subset of the tags with a wildcard, will see the logging.
// Multiple tags should be comma separated, e.g. log_error(tag1, tag2)("msg").
class LogTag : public AllStatic {
public:
// The maximum number of tags that a single log message can have.
// E.g. there might be hundreds of different tags available,
// but a specific log message can only be tagged with up to MaxTags of those.
static const size_t MaxTags = 5;
enum type {
__NO_TAG,
#define LOG_TAG(name) _##name,
LOG_TAG_LIST
#undef LOG_TAG
Count
};
static const char* name(LogTag::type tag) {
return _name[tag];
}
static LogTag::type from_string(const char *str);
static LogTag::type fuzzy_match(const char *tag);
static void list_tags(outputStream* out);
private:
static const char* _name[];
};
typedef LogTag::type LogTagType;
#endif // SHARE_VM_LOGGING_LOGTAG_HPP