author | brutisso |
Wed, 30 Sep 2015 09:07:21 +0200 | |
changeset 33107 | 77bf0d2069a3 |
parent 32380 | 1dcdb686f0cb |
child 34300 | 6075c1e0e913 |
permissions | -rw-r--r-- |
18025 | 1 |
/* |
30764 | 2 |
* Copyright (c) 2012, 2015, 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" |
|
19729
0ddd2b7bb9bd
8020692: TestGCEventMixed.java failed because of timestamp in event after end event
ehelin
parents:
18704
diff
changeset
|
31 |
#include "runtime/os.hpp" |
30764 | 32 |
#include "trace/traceBackend.hpp" |
18025 | 33 |
#include "trace/tracing.hpp" |
27684
e0391b2bf625
8064581: Move INCLUDE_ALL_GCS include section to the end of the include list
stefank
parents:
25350
diff
changeset
|
34 |
#include "utilities/macros.hpp" |
18025 | 35 |
#if INCLUDE_ALL_GCS |
30764 | 36 |
#include "gc/g1/evacuationInfo.hpp" |
37 |
#include "gc/g1/g1YCTypes.hpp" |
|
18025 | 38 |
#endif |
39 |
||
40 |
// All GC dependencies against the trace framework is contained within this file. |
|
41 |
||
42 |
typedef uintptr_t TraceAddress; |
|
43 |
||
44 |
void GCTracer::send_garbage_collection_event() const { |
|
45 |
EventGCGarbageCollection event(UNTIMED); |
|
46 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
47 |
event.set_gcId(GCId::current()); |
18025 | 48 |
event.set_name(_shared_gc_info.name()); |
49 |
event.set_cause((u2) _shared_gc_info.cause()); |
|
50 |
event.set_sumOfPauses(_shared_gc_info.sum_of_pauses()); |
|
51 |
event.set_longestPause(_shared_gc_info.longest_pause()); |
|
52 |
event.set_starttime(_shared_gc_info.start_timestamp()); |
|
53 |
event.set_endtime(_shared_gc_info.end_timestamp()); |
|
54 |
event.commit(); |
|
55 |
} |
|
56 |
} |
|
57 |
||
58 |
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
|
59 |
EventGCReferenceStatistics e; |
18025 | 60 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
61 |
e.set_gcId(GCId::current()); |
18025 | 62 |
e.set_type((u1)type); |
63 |
e.set_count(count); |
|
64 |
e.commit(); |
|
65 |
} |
|
66 |
} |
|
67 |
||
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
68 |
void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
69 |
const MetaspaceChunkFreeListSummary& summary) const { |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
70 |
EventMetaspaceChunkFreeListSummary e; |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
71 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
72 |
e.set_gcId(GCId::current()); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
73 |
e.set_when(when); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
74 |
e.set_metadataType(mdtype); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
75 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
76 |
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
|
77 |
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
|
78 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
79 |
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
|
80 |
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
|
81 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
82 |
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
|
83 |
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
|
84 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
85 |
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
|
86 |
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
|
87 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
88 |
e.commit(); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
89 |
} |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
90 |
} |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
91 |
|
18025 | 92 |
void ParallelOldTracer::send_parallel_old_event() const { |
93 |
EventGCParallelOld e(UNTIMED); |
|
94 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
95 |
e.set_gcId(GCId::current()); |
18025 | 96 |
e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix()); |
97 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
|
98 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
99 |
e.commit(); |
|
100 |
} |
|
101 |
} |
|
102 |
||
103 |
void YoungGCTracer::send_young_gc_event() const { |
|
104 |
EventGCYoungGarbageCollection e(UNTIMED); |
|
105 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
106 |
e.set_gcId(GCId::current()); |
18025 | 107 |
e.set_tenuringThreshold(_tenuring_threshold); |
108 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
|
109 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
110 |
e.commit(); |
|
111 |
} |
|
112 |
} |
|
113 |
||
28024 | 114 |
bool YoungGCTracer::should_send_promotion_in_new_plab_event() const { |
115 |
return EventPromoteObjectInNewPLAB::is_enabled(); |
|
116 |
} |
|
117 |
||
118 |
bool YoungGCTracer::should_send_promotion_outside_plab_event() const { |
|
119 |
return EventPromoteObjectOutsidePLAB::is_enabled(); |
|
120 |
} |
|
121 |
||
122 |
void YoungGCTracer::send_promotion_in_new_plab_event(Klass* klass, size_t obj_size, |
|
123 |
uint age, bool tenured, |
|
124 |
size_t plab_size) const { |
|
125 |
||
126 |
EventPromoteObjectInNewPLAB event; |
|
127 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
128 |
event.set_gcId(GCId::current()); |
28024 | 129 |
event.set_class(klass); |
130 |
event.set_objectSize(obj_size); |
|
131 |
event.set_tenured(tenured); |
|
132 |
event.set_tenuringAge(age); |
|
133 |
event.set_plabSize(plab_size); |
|
134 |
event.commit(); |
|
135 |
} |
|
136 |
} |
|
137 |
||
138 |
void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_size, |
|
139 |
uint age, bool tenured) const { |
|
140 |
||
141 |
EventPromoteObjectOutsidePLAB event; |
|
142 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
143 |
event.set_gcId(GCId::current()); |
28024 | 144 |
event.set_class(klass); |
145 |
event.set_objectSize(obj_size); |
|
146 |
event.set_tenured(tenured); |
|
147 |
event.set_tenuringAge(age); |
|
148 |
event.commit(); |
|
149 |
} |
|
150 |
} |
|
151 |
||
18025 | 152 |
void OldGCTracer::send_old_gc_event() const { |
153 |
EventGCOldGarbageCollection e(UNTIMED); |
|
154 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
155 |
e.set_gcId(GCId::current()); |
18025 | 156 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
157 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
158 |
e.commit(); |
|
159 |
} |
|
160 |
} |
|
161 |
||
162 |
static TraceStructCopyFailed to_trace_struct(const CopyFailedInfo& cf_info) { |
|
163 |
TraceStructCopyFailed failed_info; |
|
164 |
failed_info.set_objectCount(cf_info.failed_count()); |
|
165 |
failed_info.set_firstSize(cf_info.first_size()); |
|
166 |
failed_info.set_smallestSize(cf_info.smallest_size()); |
|
167 |
failed_info.set_totalSize(cf_info.total_size()); |
|
168 |
return failed_info; |
|
169 |
} |
|
170 |
||
171 |
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
|
172 |
EventPromotionFailed e; |
18025 | 173 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
174 |
e.set_gcId(GCId::current()); |
18025 | 175 |
e.set_data(to_trace_struct(pf_info)); |
176 |
e.set_thread(pf_info.thread()->thread_id()); |
|
177 |
e.commit(); |
|
178 |
} |
|
179 |
} |
|
180 |
||
181 |
// Common to CMS and G1 |
|
182 |
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
|
183 |
EventConcurrentModeFailure e; |
18025 | 184 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
185 |
e.set_gcId(GCId::current()); |
18025 | 186 |
e.commit(); |
187 |
} |
|
188 |
} |
|
189 |
||
190 |
#if INCLUDE_ALL_GCS |
|
191 |
void G1NewTracer::send_g1_young_gc_event() { |
|
192 |
EventGCG1GarbageCollection e(UNTIMED); |
|
193 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
194 |
e.set_gcId(GCId::current()); |
18025 | 195 |
e.set_type(_g1_young_gc_info.type()); |
196 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
|
197 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
198 |
e.commit(); |
|
199 |
} |
|
200 |
} |
|
201 |
||
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
202 |
void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxTime) { |
31619 | 203 |
EventGCG1MMU e; |
204 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
205 |
e.set_gcId(GCId::current()); |
31619 | 206 |
e.set_timeSlice(timeSlice); |
207 |
e.set_gcTime(gcTime); |
|
208 |
e.set_maxGcTime(maxTime); |
|
209 |
e.commit(); |
|
210 |
} |
|
211 |
} |
|
212 |
||
18025 | 213 |
void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) { |
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
214 |
EventEvacuationInfo e; |
18025 | 215 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
216 |
e.set_gcId(GCId::current()); |
18025 | 217 |
e.set_cSetRegions(info->collectionset_regions()); |
218 |
e.set_cSetUsedBefore(info->collectionset_used_before()); |
|
219 |
e.set_cSetUsedAfter(info->collectionset_used_after()); |
|
220 |
e.set_allocationRegions(info->allocation_regions()); |
|
221 |
e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); |
|
222 |
e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied()); |
|
223 |
e.set_bytesCopied(info->bytes_copied()); |
|
224 |
e.set_regionsFreed(info->regions_freed()); |
|
225 |
e.commit(); |
|
226 |
} |
|
227 |
} |
|
228 |
||
229 |
void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const { |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
230 |
EventEvacuationFailed e; |
18025 | 231 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
232 |
e.set_gcId(GCId::current()); |
18025 | 233 |
e.set_data(to_trace_struct(ef_info)); |
234 |
e.commit(); |
|
235 |
} |
|
236 |
} |
|
32380
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
237 |
|
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
238 |
static TraceStructG1EvacStats create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) { |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
239 |
TraceStructG1EvacStats s; |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
240 |
s.set_gcId(gcid); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
241 |
s.set_allocated(summary.allocated() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
242 |
s.set_wasted(summary.wasted() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
243 |
s.set_used(summary.used() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
244 |
s.set_undoWaste(summary.undo_wasted() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
245 |
s.set_regionEndWaste(summary.region_end_waste() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
246 |
s.set_regionsRefilled(summary.regions_filled()); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
247 |
s.set_directAllocated(summary.direct_allocated() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
248 |
s.set_failureUsed(summary.failure_used() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
249 |
s.set_failureWaste(summary.failure_waste() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
250 |
return s; |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
251 |
} |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
252 |
|
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
253 |
void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const { |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
254 |
EventGCG1EvacuationYoungStatistics surv_evt; |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
255 |
if (surv_evt.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
256 |
surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary)); |
32380
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
257 |
surv_evt.commit(); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
258 |
} |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
259 |
} |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
260 |
|
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
261 |
void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const { |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
262 |
EventGCG1EvacuationOldStatistics old_evt; |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
263 |
if (old_evt.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
264 |
old_evt.set_stats(create_g1_evacstats(GCId::current(), summary)); |
32380
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
265 |
old_evt.commit(); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
266 |
} |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
267 |
} |
18025 | 268 |
#endif |
269 |
||
270 |
static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) { |
|
271 |
TraceStructVirtualSpace space; |
|
272 |
space.set_start((TraceAddress)summary.start()); |
|
273 |
space.set_committedEnd((TraceAddress)summary.committed_end()); |
|
274 |
space.set_committedSize(summary.committed_size()); |
|
275 |
space.set_reservedEnd((TraceAddress)summary.reserved_end()); |
|
276 |
space.set_reservedSize(summary.reserved_size()); |
|
277 |
return space; |
|
278 |
} |
|
279 |
||
280 |
static TraceStructObjectSpace to_trace_struct(const SpaceSummary& summary) { |
|
281 |
TraceStructObjectSpace space; |
|
282 |
space.set_start((TraceAddress)summary.start()); |
|
283 |
space.set_end((TraceAddress)summary.end()); |
|
284 |
space.set_used(summary.used()); |
|
285 |
space.set_size(summary.size()); |
|
286 |
return space; |
|
287 |
} |
|
288 |
||
289 |
class GCHeapSummaryEventSender : public GCHeapSummaryVisitor { |
|
290 |
GCWhen::Type _when; |
|
291 |
public: |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
292 |
GCHeapSummaryEventSender(GCWhen::Type when) : _when(when) {} |
18025 | 293 |
|
294 |
void visit(const GCHeapSummary* heap_summary) const { |
|
295 |
const VirtualSpaceSummary& heap_space = heap_summary->heap(); |
|
296 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
297 |
EventGCHeapSummary e; |
18025 | 298 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
299 |
e.set_gcId(GCId::current()); |
18025 | 300 |
e.set_when((u1)_when); |
301 |
e.set_heapSpace(to_trace_struct(heap_space)); |
|
302 |
e.set_heapUsed(heap_summary->used()); |
|
303 |
e.commit(); |
|
304 |
} |
|
305 |
} |
|
306 |
||
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
307 |
void visit(const G1HeapSummary* g1_heap_summary) const { |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
308 |
visit((GCHeapSummary*)g1_heap_summary); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
309 |
|
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
310 |
EventG1HeapSummary e; |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
311 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
312 |
e.set_gcId(GCId::current()); |
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
313 |
e.set_when((u1)_when); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
314 |
e.set_edenUsedSize(g1_heap_summary->edenUsed()); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
315 |
e.set_edenTotalSize(g1_heap_summary->edenCapacity()); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
316 |
e.set_survivorUsedSize(g1_heap_summary->survivorUsed()); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
317 |
e.commit(); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
318 |
} |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
319 |
} |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
320 |
|
18025 | 321 |
void visit(const PSHeapSummary* ps_heap_summary) const { |
322 |
visit((GCHeapSummary*)ps_heap_summary); |
|
323 |
||
324 |
const VirtualSpaceSummary& old_summary = ps_heap_summary->old(); |
|
325 |
const SpaceSummary& old_space = ps_heap_summary->old_space(); |
|
326 |
const VirtualSpaceSummary& young_summary = ps_heap_summary->young(); |
|
327 |
const SpaceSummary& eden_space = ps_heap_summary->eden(); |
|
328 |
const SpaceSummary& from_space = ps_heap_summary->from(); |
|
329 |
const SpaceSummary& to_space = ps_heap_summary->to(); |
|
330 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
331 |
EventPSHeapSummary e; |
18025 | 332 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
333 |
e.set_gcId(GCId::current()); |
18025 | 334 |
e.set_when((u1)_when); |
335 |
||
336 |
e.set_oldSpace(to_trace_struct(ps_heap_summary->old())); |
|
337 |
e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space())); |
|
338 |
e.set_youngSpace(to_trace_struct(ps_heap_summary->young())); |
|
339 |
e.set_edenSpace(to_trace_struct(ps_heap_summary->eden())); |
|
340 |
e.set_fromSpace(to_trace_struct(ps_heap_summary->from())); |
|
341 |
e.set_toSpace(to_trace_struct(ps_heap_summary->to())); |
|
342 |
e.commit(); |
|
343 |
} |
|
344 |
} |
|
345 |
}; |
|
346 |
||
347 |
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
|
348 |
GCHeapSummaryEventSender visitor(when); |
18025 | 349 |
heap_summary.accept(&visitor); |
350 |
} |
|
351 |
||
352 |
static TraceStructMetaspaceSizes to_trace_struct(const MetaspaceSizes& sizes) { |
|
353 |
TraceStructMetaspaceSizes meta_sizes; |
|
354 |
||
23853
3e1633ff6996
8035667: EventMetaspaceSummary doesn't report committed Metaspace memory
ehelin
parents:
23470
diff
changeset
|
355 |
meta_sizes.set_committed(sizes.committed()); |
18025 | 356 |
meta_sizes.set_used(sizes.used()); |
357 |
meta_sizes.set_reserved(sizes.reserved()); |
|
358 |
||
359 |
return meta_sizes; |
|
360 |
} |
|
361 |
||
362 |
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
|
363 |
EventMetaspaceSummary e; |
18025 | 364 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
365 |
e.set_gcId(GCId::current()); |
18025 | 366 |
e.set_when((u1) when); |
23464
ae470a2efd44
8036696: Add metaspace gc threshold to metaspace summary trace event
ehelin
parents:
21767
diff
changeset
|
367 |
e.set_gcThreshold(meta_space_summary.capacity_until_GC()); |
18025 | 368 |
e.set_metaspace(to_trace_struct(meta_space_summary.meta_space())); |
369 |
e.set_dataSpace(to_trace_struct(meta_space_summary.data_space())); |
|
370 |
e.set_classSpace(to_trace_struct(meta_space_summary.class_space())); |
|
371 |
e.commit(); |
|
372 |
} |
|
373 |
} |
|
374 |
||
375 |
class PhaseSender : public PhaseVisitor { |
|
376 |
public: |
|
377 |
template<typename T> |
|
378 |
void send_phase(PausePhase* pause) { |
|
379 |
T event(UNTIMED); |
|
380 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
381 |
event.set_gcId(GCId::current()); |
18025 | 382 |
event.set_name(pause->name()); |
383 |
event.set_starttime(pause->start()); |
|
384 |
event.set_endtime(pause->end()); |
|
385 |
event.commit(); |
|
386 |
} |
|
387 |
} |
|
388 |
||
389 |
void visit(GCPhase* pause) { ShouldNotReachHere(); } |
|
390 |
void visit(ConcurrentPhase* pause) { Unimplemented(); } |
|
391 |
void visit(PausePhase* pause) { |
|
392 |
assert(PhasesStack::PHASE_LEVELS == 5, "Need more event types"); |
|
393 |
||
394 |
switch (pause->level()) { |
|
395 |
case 0: send_phase<EventGCPhasePause>(pause); break; |
|
396 |
case 1: send_phase<EventGCPhasePauseLevel1>(pause); break; |
|
397 |
case 2: send_phase<EventGCPhasePauseLevel2>(pause); break; |
|
398 |
case 3: send_phase<EventGCPhasePauseLevel3>(pause); break; |
|
399 |
default: /* Ignore sending this phase */ break; |
|
400 |
} |
|
401 |
} |
|
402 |
}; |
|
403 |
||
404 |
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
|
405 |
PhaseSender phase_reporter; |
18025 | 406 |
|
407 |
TimePartitionPhasesIterator iter(time_partitions); |
|
408 |
while (iter.has_next()) { |
|
409 |
GCPhase* phase = iter.next(); |
|
410 |
phase->accept(&phase_reporter); |
|
411 |
} |
|
412 |
} |