author | stuefe |
Tue, 26 Nov 2019 16:21:29 +0100 | |
branch | stuefe-new-metaspace-branch |
changeset 59272 | 54750b448264 |
parent 58063 | bdf136b8ae0e |
permissions | -rw-r--r-- |
18025 | 1 |
/* |
58002
01d31583f25c
8230431: Move G1 trace code from gcTrace* to G1 directory
sjohanss
parents:
53411
diff
changeset
|
2 |
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
18025 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "precompiled.hpp" |
|
30764 | 26 |
#include "gc/shared/copyFailedInfo.hpp" |
27 |
#include "gc/shared/gcHeapSummary.hpp" |
|
28 |
#include "gc/shared/gcTimer.hpp" |
|
29 |
#include "gc/shared/gcTrace.hpp" |
|
30 |
#include "gc/shared/gcWhen.hpp" |
|
50113 | 31 |
#include "jfr/jfrEvents.hpp" |
19729
0ddd2b7bb9bd
8020692: TestGCEventMixed.java failed because of timestamp in event after end event
ehelin
parents:
18704
diff
changeset
|
32 |
#include "runtime/os.hpp" |
27684
e0391b2bf625
8064581: Move INCLUDE_ALL_GCS include section to the end of the include list
stefank
parents:
25350
diff
changeset
|
33 |
#include "utilities/macros.hpp" |
18025 | 34 |
|
35 |
// All GC dependencies against the trace framework is contained within this file. |
|
36 |
||
37 |
typedef uintptr_t TraceAddress; |
|
38 |
||
39 |
void GCTracer::send_garbage_collection_event() const { |
|
40664
1ec65b303bb7
8164523: Clean up metadata for event based tracing
egahlin
parents:
39980
diff
changeset
|
40 |
EventGarbageCollection event(UNTIMED); |
18025 | 41 |
if (event.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
42 |
event.set_gcId(GCId::current()); |
18025 | 43 |
event.set_name(_shared_gc_info.name()); |
44 |
event.set_cause((u2) _shared_gc_info.cause()); |
|
45 |
event.set_sumOfPauses(_shared_gc_info.sum_of_pauses()); |
|
46 |
event.set_longestPause(_shared_gc_info.longest_pause()); |
|
47 |
event.set_starttime(_shared_gc_info.start_timestamp()); |
|
48 |
event.set_endtime(_shared_gc_info.end_timestamp()); |
|
49 |
event.commit(); |
|
50 |
} |
|
51 |
} |
|
52 |
||
53 |
void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const { |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
54 |
EventGCReferenceStatistics e; |
18025 | 55 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
56 |
e.set_gcId(GCId::current()); |
18025 | 57 |
e.set_type((u1)type); |
58 |
e.set_count(count); |
|
59 |
e.commit(); |
|
60 |
} |
|
61 |
} |
|
62 |
||
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58063
diff
changeset
|
63 |
void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
64 |
const MetaspaceChunkFreeListSummary& summary) const { |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
65 |
EventMetaspaceChunkFreeListSummary e; |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
66 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
67 |
e.set_gcId(GCId::current()); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
68 |
e.set_when(when); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
69 |
e.set_metadataType(mdtype); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
70 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
71 |
e.set_specializedChunks(summary.num_specialized_chunks()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
72 |
e.set_specializedChunksTotalSize(summary.specialized_chunks_size_in_bytes()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
73 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
74 |
e.set_smallChunks(summary.num_small_chunks()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
75 |
e.set_smallChunksTotalSize(summary.small_chunks_size_in_bytes()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
76 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
77 |
e.set_mediumChunks(summary.num_medium_chunks()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
78 |
e.set_mediumChunksTotalSize(summary.medium_chunks_size_in_bytes()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
79 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
80 |
e.set_humongousChunks(summary.num_humongous_chunks()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
81 |
e.set_humongousChunksTotalSize(summary.humongous_chunks_size_in_bytes()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
82 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
83 |
e.commit(); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
84 |
} |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
85 |
} |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
86 |
|
18025 | 87 |
void ParallelOldTracer::send_parallel_old_event() const { |
40664
1ec65b303bb7
8164523: Clean up metadata for event based tracing
egahlin
parents:
39980
diff
changeset
|
88 |
EventParallelOldGarbageCollection e(UNTIMED); |
18025 | 89 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
90 |
e.set_gcId(GCId::current()); |
18025 | 91 |
e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix()); |
92 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
|
93 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
94 |
e.commit(); |
|
95 |
} |
|
96 |
} |
|
97 |
||
98 |
void YoungGCTracer::send_young_gc_event() const { |
|
40664
1ec65b303bb7
8164523: Clean up metadata for event based tracing
egahlin
parents:
39980
diff
changeset
|
99 |
EventYoungGarbageCollection e(UNTIMED); |
18025 | 100 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
101 |
e.set_gcId(GCId::current()); |
18025 | 102 |
e.set_tenuringThreshold(_tenuring_threshold); |
103 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
|
104 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
105 |
e.commit(); |
|
106 |
} |
|
107 |
} |
|
108 |
||
28024 | 109 |
bool YoungGCTracer::should_send_promotion_in_new_plab_event() const { |
110 |
return EventPromoteObjectInNewPLAB::is_enabled(); |
|
111 |
} |
|
112 |
||
113 |
bool YoungGCTracer::should_send_promotion_outside_plab_event() const { |
|
114 |
return EventPromoteObjectOutsidePLAB::is_enabled(); |
|
115 |
} |
|
116 |
||
117 |
void YoungGCTracer::send_promotion_in_new_plab_event(Klass* klass, size_t obj_size, |
|
118 |
uint age, bool tenured, |
|
119 |
size_t plab_size) const { |
|
120 |
||
121 |
EventPromoteObjectInNewPLAB event; |
|
122 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
123 |
event.set_gcId(GCId::current()); |
40664
1ec65b303bb7
8164523: Clean up metadata for event based tracing
egahlin
parents:
39980
diff
changeset
|
124 |
event.set_objectClass(klass); |
28024 | 125 |
event.set_objectSize(obj_size); |
126 |
event.set_tenured(tenured); |
|
127 |
event.set_tenuringAge(age); |
|
128 |
event.set_plabSize(plab_size); |
|
129 |
event.commit(); |
|
130 |
} |
|
131 |
} |
|
132 |
||
133 |
void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_size, |
|
134 |
uint age, bool tenured) const { |
|
135 |
||
136 |
EventPromoteObjectOutsidePLAB event; |
|
137 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
138 |
event.set_gcId(GCId::current()); |
40664
1ec65b303bb7
8164523: Clean up metadata for event based tracing
egahlin
parents:
39980
diff
changeset
|
139 |
event.set_objectClass(klass); |
28024 | 140 |
event.set_objectSize(obj_size); |
141 |
event.set_tenured(tenured); |
|
142 |
event.set_tenuringAge(age); |
|
143 |
event.commit(); |
|
144 |
} |
|
145 |
} |
|
146 |
||
18025 | 147 |
void OldGCTracer::send_old_gc_event() const { |
40664
1ec65b303bb7
8164523: Clean up metadata for event based tracing
egahlin
parents:
39980
diff
changeset
|
148 |
EventOldGarbageCollection e(UNTIMED); |
18025 | 149 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
150 |
e.set_gcId(GCId::current()); |
18025 | 151 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
152 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
153 |
e.commit(); |
|
154 |
} |
|
155 |
} |
|
156 |
||
50113 | 157 |
static JfrStructCopyFailed to_struct(const CopyFailedInfo& cf_info) { |
158 |
JfrStructCopyFailed failed_info; |
|
18025 | 159 |
failed_info.set_objectCount(cf_info.failed_count()); |
160 |
failed_info.set_firstSize(cf_info.first_size()); |
|
161 |
failed_info.set_smallestSize(cf_info.smallest_size()); |
|
162 |
failed_info.set_totalSize(cf_info.total_size()); |
|
163 |
return failed_info; |
|
164 |
} |
|
165 |
||
166 |
void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
167 |
EventPromotionFailed e; |
18025 | 168 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
169 |
e.set_gcId(GCId::current()); |
50113 | 170 |
e.set_promotionFailed(to_struct(pf_info)); |
36384 | 171 |
e.set_thread(pf_info.thread_trace_id()); |
18025 | 172 |
e.commit(); |
173 |
} |
|
174 |
} |
|
175 |
||
176 |
// Common to CMS and G1 |
|
177 |
void OldGCTracer::send_concurrent_mode_failure_event() { |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
178 |
EventConcurrentModeFailure e; |
18025 | 179 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
180 |
e.set_gcId(GCId::current()); |
18025 | 181 |
e.commit(); |
182 |
} |
|
183 |
} |
|
184 |
||
50113 | 185 |
static JfrStructVirtualSpace to_struct(const VirtualSpaceSummary& summary) { |
186 |
JfrStructVirtualSpace space; |
|
18025 | 187 |
space.set_start((TraceAddress)summary.start()); |
188 |
space.set_committedEnd((TraceAddress)summary.committed_end()); |
|
189 |
space.set_committedSize(summary.committed_size()); |
|
190 |
space.set_reservedEnd((TraceAddress)summary.reserved_end()); |
|
191 |
space.set_reservedSize(summary.reserved_size()); |
|
192 |
return space; |
|
193 |
} |
|
194 |
||
50113 | 195 |
static JfrStructObjectSpace to_struct(const SpaceSummary& summary) { |
196 |
JfrStructObjectSpace space; |
|
18025 | 197 |
space.set_start((TraceAddress)summary.start()); |
198 |
space.set_end((TraceAddress)summary.end()); |
|
199 |
space.set_used(summary.used()); |
|
200 |
space.set_size(summary.size()); |
|
201 |
return space; |
|
202 |
} |
|
203 |
||
204 |
class GCHeapSummaryEventSender : public GCHeapSummaryVisitor { |
|
205 |
GCWhen::Type _when; |
|
206 |
public: |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
207 |
GCHeapSummaryEventSender(GCWhen::Type when) : _when(when) {} |
18025 | 208 |
|
209 |
void visit(const GCHeapSummary* heap_summary) const { |
|
210 |
const VirtualSpaceSummary& heap_space = heap_summary->heap(); |
|
211 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
212 |
EventGCHeapSummary e; |
18025 | 213 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
214 |
e.set_gcId(GCId::current()); |
18025 | 215 |
e.set_when((u1)_when); |
50113 | 216 |
e.set_heapSpace(to_struct(heap_space)); |
18025 | 217 |
e.set_heapUsed(heap_summary->used()); |
218 |
e.commit(); |
|
219 |
} |
|
220 |
} |
|
221 |
||
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
222 |
void visit(const G1HeapSummary* g1_heap_summary) const { |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
223 |
visit((GCHeapSummary*)g1_heap_summary); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
224 |
|
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
225 |
EventG1HeapSummary e; |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
226 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
227 |
e.set_gcId(GCId::current()); |
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
228 |
e.set_when((u1)_when); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
229 |
e.set_edenUsedSize(g1_heap_summary->edenUsed()); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
230 |
e.set_edenTotalSize(g1_heap_summary->edenCapacity()); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
231 |
e.set_survivorUsedSize(g1_heap_summary->survivorUsed()); |
36095
2d530b26ae5c
8149648: Add number of regions to the G1HeapSummary event
david
parents:
35204
diff
changeset
|
232 |
e.set_numberOfRegions(g1_heap_summary->numberOfRegions()); |
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
233 |
e.commit(); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
234 |
} |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
235 |
} |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
236 |
|
18025 | 237 |
void visit(const PSHeapSummary* ps_heap_summary) const { |
238 |
visit((GCHeapSummary*)ps_heap_summary); |
|
239 |
||
240 |
const VirtualSpaceSummary& old_summary = ps_heap_summary->old(); |
|
241 |
const SpaceSummary& old_space = ps_heap_summary->old_space(); |
|
242 |
const VirtualSpaceSummary& young_summary = ps_heap_summary->young(); |
|
243 |
const SpaceSummary& eden_space = ps_heap_summary->eden(); |
|
244 |
const SpaceSummary& from_space = ps_heap_summary->from(); |
|
245 |
const SpaceSummary& to_space = ps_heap_summary->to(); |
|
246 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
247 |
EventPSHeapSummary e; |
18025 | 248 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
249 |
e.set_gcId(GCId::current()); |
18025 | 250 |
e.set_when((u1)_when); |
251 |
||
50113 | 252 |
e.set_oldSpace(to_struct(ps_heap_summary->old())); |
253 |
e.set_oldObjectSpace(to_struct(ps_heap_summary->old_space())); |
|
254 |
e.set_youngSpace(to_struct(ps_heap_summary->young())); |
|
255 |
e.set_edenSpace(to_struct(ps_heap_summary->eden())); |
|
256 |
e.set_fromSpace(to_struct(ps_heap_summary->from())); |
|
257 |
e.set_toSpace(to_struct(ps_heap_summary->to())); |
|
18025 | 258 |
e.commit(); |
259 |
} |
|
260 |
} |
|
261 |
}; |
|
262 |
||
263 |
void GCTracer::send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
264 |
GCHeapSummaryEventSender visitor(when); |
18025 | 265 |
heap_summary.accept(&visitor); |
266 |
} |
|
267 |
||
50113 | 268 |
static JfrStructMetaspaceSizes to_struct(const MetaspaceSizes& sizes) { |
269 |
JfrStructMetaspaceSizes meta_sizes; |
|
18025 | 270 |
|
23853
3e1633ff6996
8035667: EventMetaspaceSummary doesn't report committed Metaspace memory
ehelin
parents:
23470
diff
changeset
|
271 |
meta_sizes.set_committed(sizes.committed()); |
18025 | 272 |
meta_sizes.set_used(sizes.used()); |
273 |
meta_sizes.set_reserved(sizes.reserved()); |
|
274 |
||
275 |
return meta_sizes; |
|
276 |
} |
|
277 |
||
278 |
void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const { |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
279 |
EventMetaspaceSummary e; |
18025 | 280 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
281 |
e.set_gcId(GCId::current()); |
18025 | 282 |
e.set_when((u1) when); |
23464
ae470a2efd44
8036696: Add metaspace gc threshold to metaspace summary trace event
ehelin
parents:
21767
diff
changeset
|
283 |
e.set_gcThreshold(meta_space_summary.capacity_until_GC()); |
50113 | 284 |
e.set_metaspace(to_struct(meta_space_summary.meta_space())); |
285 |
e.set_dataSpace(to_struct(meta_space_summary.data_space())); |
|
286 |
e.set_classSpace(to_struct(meta_space_summary.class_space())); |
|
18025 | 287 |
e.commit(); |
288 |
} |
|
289 |
} |
|
290 |
||
291 |
class PhaseSender : public PhaseVisitor { |
|
35204 | 292 |
void visit_pause(GCPhase* phase) { |
293 |
assert(phase->level() < PhasesStack::PHASE_LEVELS, "Need more event types for PausePhase"); |
|
294 |
||
295 |
switch (phase->level()) { |
|
296 |
case 0: send_phase<EventGCPhasePause>(phase); break; |
|
297 |
case 1: send_phase<EventGCPhasePauseLevel1>(phase); break; |
|
298 |
case 2: send_phase<EventGCPhasePauseLevel2>(phase); break; |
|
299 |
case 3: send_phase<EventGCPhasePauseLevel3>(phase); break; |
|
46795
623a5e42deb6
8173335: Improve logging for j.l.ref.reference processing
sangheki
parents:
41076
diff
changeset
|
300 |
case 4: send_phase<EventGCPhasePauseLevel4>(phase); break; |
35204 | 301 |
default: /* Ignore sending this phase */ break; |
302 |
} |
|
303 |
} |
|
304 |
||
305 |
void visit_concurrent(GCPhase* phase) { |
|
306 |
assert(phase->level() < 1, "There is only one level for ConcurrentPhase"); |
|
307 |
||
308 |
switch (phase->level()) { |
|
309 |
case 0: send_phase<EventGCPhaseConcurrent>(phase); break; |
|
310 |
default: /* Ignore sending this phase */ break; |
|
311 |
} |
|
312 |
} |
|
313 |
||
18025 | 314 |
public: |
315 |
template<typename T> |
|
35204 | 316 |
void send_phase(GCPhase* phase) { |
18025 | 317 |
T event(UNTIMED); |
318 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
319 |
event.set_gcId(GCId::current()); |
35204 | 320 |
event.set_name(phase->name()); |
321 |
event.set_starttime(phase->start()); |
|
322 |
event.set_endtime(phase->end()); |
|
18025 | 323 |
event.commit(); |
324 |
} |
|
325 |
} |
|
326 |
||
35204 | 327 |
void visit(GCPhase* phase) { |
328 |
if (phase->type() == GCPhase::PausePhaseType) { |
|
329 |
visit_pause(phase); |
|
330 |
} else { |
|
331 |
assert(phase->type() == GCPhase::ConcurrentPhaseType, "Should be ConcurrentPhaseType"); |
|
332 |
visit_concurrent(phase); |
|
18025 | 333 |
} |
334 |
} |
|
335 |
}; |
|
336 |
||
337 |
void GCTracer::send_phase_events(TimePartitions* time_partitions) const { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
338 |
PhaseSender phase_reporter; |
18025 | 339 |
|
340 |
TimePartitionPhasesIterator iter(time_partitions); |
|
341 |
while (iter.has_next()) { |
|
342 |
GCPhase* phase = iter.next(); |
|
343 |
phase->accept(&phase_reporter); |
|
344 |
} |
|
345 |
} |