author | david |
Thu, 11 Feb 2016 16:49:12 +0100 | |
changeset 36095 | 2d530b26ae5c |
parent 35204 | 78a0fd90a70f |
child 36384 | b0b41336a9a8 |
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" |
|
34300 | 38 |
#include "tracefiles/traceEventClasses.hpp" |
18025 | 39 |
#endif |
40 |
||
41 |
// All GC dependencies against the trace framework is contained within this file. |
|
42 |
||
43 |
typedef uintptr_t TraceAddress; |
|
44 |
||
45 |
void GCTracer::send_garbage_collection_event() const { |
|
46 |
EventGCGarbageCollection event(UNTIMED); |
|
47 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
48 |
event.set_gcId(GCId::current()); |
18025 | 49 |
event.set_name(_shared_gc_info.name()); |
50 |
event.set_cause((u2) _shared_gc_info.cause()); |
|
51 |
event.set_sumOfPauses(_shared_gc_info.sum_of_pauses()); |
|
52 |
event.set_longestPause(_shared_gc_info.longest_pause()); |
|
53 |
event.set_starttime(_shared_gc_info.start_timestamp()); |
|
54 |
event.set_endtime(_shared_gc_info.end_timestamp()); |
|
55 |
event.commit(); |
|
56 |
} |
|
57 |
} |
|
58 |
||
59 |
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
|
60 |
EventGCReferenceStatistics e; |
18025 | 61 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
62 |
e.set_gcId(GCId::current()); |
18025 | 63 |
e.set_type((u1)type); |
64 |
e.set_count(count); |
|
65 |
e.commit(); |
|
66 |
} |
|
67 |
} |
|
68 |
||
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
69 |
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
|
70 |
const MetaspaceChunkFreeListSummary& summary) const { |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
71 |
EventMetaspaceChunkFreeListSummary e; |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
72 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
73 |
e.set_gcId(GCId::current()); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
74 |
e.set_when(when); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
75 |
e.set_metadataType(mdtype); |
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_specializedChunks(summary.num_specialized_chunks()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
78 |
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
|
79 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
80 |
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
|
81 |
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
|
82 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
83 |
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
|
84 |
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
|
85 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
86 |
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
|
87 |
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
|
88 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
89 |
e.commit(); |
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 |
} |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
92 |
|
18025 | 93 |
void ParallelOldTracer::send_parallel_old_event() const { |
94 |
EventGCParallelOld e(UNTIMED); |
|
95 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
96 |
e.set_gcId(GCId::current()); |
18025 | 97 |
e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix()); |
98 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
|
99 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
100 |
e.commit(); |
|
101 |
} |
|
102 |
} |
|
103 |
||
104 |
void YoungGCTracer::send_young_gc_event() const { |
|
105 |
EventGCYoungGarbageCollection e(UNTIMED); |
|
106 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
107 |
e.set_gcId(GCId::current()); |
18025 | 108 |
e.set_tenuringThreshold(_tenuring_threshold); |
109 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
|
110 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
111 |
e.commit(); |
|
112 |
} |
|
113 |
} |
|
114 |
||
28024 | 115 |
bool YoungGCTracer::should_send_promotion_in_new_plab_event() const { |
116 |
return EventPromoteObjectInNewPLAB::is_enabled(); |
|
117 |
} |
|
118 |
||
119 |
bool YoungGCTracer::should_send_promotion_outside_plab_event() const { |
|
120 |
return EventPromoteObjectOutsidePLAB::is_enabled(); |
|
121 |
} |
|
122 |
||
123 |
void YoungGCTracer::send_promotion_in_new_plab_event(Klass* klass, size_t obj_size, |
|
124 |
uint age, bool tenured, |
|
125 |
size_t plab_size) const { |
|
126 |
||
127 |
EventPromoteObjectInNewPLAB event; |
|
128 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
129 |
event.set_gcId(GCId::current()); |
28024 | 130 |
event.set_class(klass); |
131 |
event.set_objectSize(obj_size); |
|
132 |
event.set_tenured(tenured); |
|
133 |
event.set_tenuringAge(age); |
|
134 |
event.set_plabSize(plab_size); |
|
135 |
event.commit(); |
|
136 |
} |
|
137 |
} |
|
138 |
||
139 |
void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_size, |
|
140 |
uint age, bool tenured) const { |
|
141 |
||
142 |
EventPromoteObjectOutsidePLAB event; |
|
143 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
144 |
event.set_gcId(GCId::current()); |
28024 | 145 |
event.set_class(klass); |
146 |
event.set_objectSize(obj_size); |
|
147 |
event.set_tenured(tenured); |
|
148 |
event.set_tenuringAge(age); |
|
149 |
event.commit(); |
|
150 |
} |
|
151 |
} |
|
152 |
||
18025 | 153 |
void OldGCTracer::send_old_gc_event() const { |
154 |
EventGCOldGarbageCollection e(UNTIMED); |
|
155 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
156 |
e.set_gcId(GCId::current()); |
18025 | 157 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
158 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
159 |
e.commit(); |
|
160 |
} |
|
161 |
} |
|
162 |
||
163 |
static TraceStructCopyFailed to_trace_struct(const CopyFailedInfo& cf_info) { |
|
164 |
TraceStructCopyFailed failed_info; |
|
165 |
failed_info.set_objectCount(cf_info.failed_count()); |
|
166 |
failed_info.set_firstSize(cf_info.first_size()); |
|
167 |
failed_info.set_smallestSize(cf_info.smallest_size()); |
|
168 |
failed_info.set_totalSize(cf_info.total_size()); |
|
169 |
return failed_info; |
|
170 |
} |
|
171 |
||
172 |
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
|
173 |
EventPromotionFailed e; |
18025 | 174 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
175 |
e.set_gcId(GCId::current()); |
18025 | 176 |
e.set_data(to_trace_struct(pf_info)); |
177 |
e.set_thread(pf_info.thread()->thread_id()); |
|
178 |
e.commit(); |
|
179 |
} |
|
180 |
} |
|
181 |
||
182 |
// Common to CMS and G1 |
|
183 |
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
|
184 |
EventConcurrentModeFailure e; |
18025 | 185 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
186 |
e.set_gcId(GCId::current()); |
18025 | 187 |
e.commit(); |
188 |
} |
|
189 |
} |
|
190 |
||
191 |
#if INCLUDE_ALL_GCS |
|
192 |
void G1NewTracer::send_g1_young_gc_event() { |
|
193 |
EventGCG1GarbageCollection e(UNTIMED); |
|
194 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
195 |
e.set_gcId(GCId::current()); |
18025 | 196 |
e.set_type(_g1_young_gc_info.type()); |
197 |
e.set_starttime(_shared_gc_info.start_timestamp()); |
|
198 |
e.set_endtime(_shared_gc_info.end_timestamp()); |
|
199 |
e.commit(); |
|
200 |
} |
|
201 |
} |
|
202 |
||
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
203 |
void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxTime) { |
31619 | 204 |
EventGCG1MMU e; |
205 |
if (e.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
206 |
e.set_gcId(GCId::current()); |
31619 | 207 |
e.set_timeSlice(timeSlice); |
208 |
e.set_gcTime(gcTime); |
|
209 |
e.set_maxGcTime(maxTime); |
|
210 |
e.commit(); |
|
211 |
} |
|
212 |
} |
|
213 |
||
18025 | 214 |
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
|
215 |
EventEvacuationInfo e; |
18025 | 216 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
217 |
e.set_gcId(GCId::current()); |
18025 | 218 |
e.set_cSetRegions(info->collectionset_regions()); |
219 |
e.set_cSetUsedBefore(info->collectionset_used_before()); |
|
220 |
e.set_cSetUsedAfter(info->collectionset_used_after()); |
|
221 |
e.set_allocationRegions(info->allocation_regions()); |
|
222 |
e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); |
|
223 |
e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied()); |
|
224 |
e.set_bytesCopied(info->bytes_copied()); |
|
225 |
e.set_regionsFreed(info->regions_freed()); |
|
226 |
e.commit(); |
|
227 |
} |
|
228 |
} |
|
229 |
||
230 |
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
|
231 |
EventEvacuationFailed e; |
18025 | 232 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
233 |
e.set_gcId(GCId::current()); |
18025 | 234 |
e.set_data(to_trace_struct(ef_info)); |
235 |
e.commit(); |
|
236 |
} |
|
237 |
} |
|
32380
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
238 |
|
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
239 |
static TraceStructG1EvacStats create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) { |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
240 |
TraceStructG1EvacStats s; |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
241 |
s.set_gcId(gcid); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
242 |
s.set_allocated(summary.allocated() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
243 |
s.set_wasted(summary.wasted() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
244 |
s.set_used(summary.used() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
245 |
s.set_undoWaste(summary.undo_wasted() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
246 |
s.set_regionEndWaste(summary.region_end_waste() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
247 |
s.set_regionsRefilled(summary.regions_filled()); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
248 |
s.set_directAllocated(summary.direct_allocated() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
249 |
s.set_failureUsed(summary.failure_used() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
250 |
s.set_failureWaste(summary.failure_waste() * HeapWordSize); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
251 |
return s; |
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 |
|
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
254 |
void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const { |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
255 |
EventGCG1EvacuationYoungStatistics surv_evt; |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
256 |
if (surv_evt.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
257 |
surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary)); |
32380
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
258 |
surv_evt.commit(); |
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 |
|
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
262 |
void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const { |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
263 |
EventGCG1EvacuationOldStatistics old_evt; |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
264 |
if (old_evt.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
265 |
old_evt.set_stats(create_g1_evacstats(GCId::current(), summary)); |
32380
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
266 |
old_evt.commit(); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
267 |
} |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
268 |
} |
34300 | 269 |
|
270 |
void G1NewTracer::send_basic_ihop_statistics(size_t threshold, |
|
271 |
size_t target_occupancy, |
|
272 |
size_t current_occupancy, |
|
273 |
size_t last_allocation_size, |
|
274 |
double last_allocation_duration, |
|
275 |
double last_marking_length) { |
|
276 |
EventGCG1BasicIHOP evt; |
|
277 |
if (evt.should_commit()) { |
|
278 |
evt.set_gcId(GCId::current()); |
|
279 |
evt.set_threshold(threshold); |
|
280 |
evt.set_targetOccupancy(target_occupancy); |
|
35196
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
34300
diff
changeset
|
281 |
evt.set_thresholdPercentage(target_occupancy > 0 ? (threshold * 100 / target_occupancy) : 0); |
34300 | 282 |
evt.set_currentOccupancy(current_occupancy); |
283 |
evt.set_lastAllocationSize(last_allocation_size); |
|
284 |
evt.set_lastAllocationDuration(last_allocation_duration); |
|
285 |
evt.set_lastAllocationRate(last_allocation_duration != 0.0 ? last_allocation_size / last_allocation_duration : 0.0); |
|
286 |
evt.set_lastMarkingLength(last_marking_length); |
|
287 |
evt.commit(); |
|
288 |
} |
|
289 |
} |
|
290 |
||
291 |
void G1NewTracer::send_adaptive_ihop_statistics(size_t threshold, |
|
292 |
size_t internal_target_occupancy, |
|
293 |
size_t current_occupancy, |
|
294 |
size_t additional_buffer_size, |
|
295 |
double predicted_allocation_rate, |
|
296 |
double predicted_marking_length, |
|
297 |
bool prediction_active) { |
|
298 |
EventGCG1AdaptiveIHOP evt; |
|
299 |
if (evt.should_commit()) { |
|
300 |
evt.set_gcId(GCId::current()); |
|
301 |
evt.set_threshold(threshold); |
|
35196
c83940b346b2
8143215: gcc 4.1.2: fix three issues breaking the build.
goetz
parents:
34300
diff
changeset
|
302 |
evt.set_thresholdPercentage(internal_target_occupancy > 0 ? (threshold * 100 / internal_target_occupancy) : 0); |
34300 | 303 |
evt.set_internalTargetOccupancy(internal_target_occupancy); |
304 |
evt.set_currentOccupancy(current_occupancy); |
|
305 |
evt.set_additionalBufferSize(additional_buffer_size); |
|
306 |
evt.set_predictedAllocationRate(predicted_allocation_rate); |
|
307 |
evt.set_predictedMarkingLength(predicted_marking_length); |
|
308 |
evt.set_predictionActive(prediction_active); |
|
309 |
evt.commit(); |
|
310 |
} |
|
311 |
} |
|
312 |
||
18025 | 313 |
#endif |
314 |
||
315 |
static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) { |
|
316 |
TraceStructVirtualSpace space; |
|
317 |
space.set_start((TraceAddress)summary.start()); |
|
318 |
space.set_committedEnd((TraceAddress)summary.committed_end()); |
|
319 |
space.set_committedSize(summary.committed_size()); |
|
320 |
space.set_reservedEnd((TraceAddress)summary.reserved_end()); |
|
321 |
space.set_reservedSize(summary.reserved_size()); |
|
322 |
return space; |
|
323 |
} |
|
324 |
||
325 |
static TraceStructObjectSpace to_trace_struct(const SpaceSummary& summary) { |
|
326 |
TraceStructObjectSpace space; |
|
327 |
space.set_start((TraceAddress)summary.start()); |
|
328 |
space.set_end((TraceAddress)summary.end()); |
|
329 |
space.set_used(summary.used()); |
|
330 |
space.set_size(summary.size()); |
|
331 |
return space; |
|
332 |
} |
|
333 |
||
334 |
class GCHeapSummaryEventSender : public GCHeapSummaryVisitor { |
|
335 |
GCWhen::Type _when; |
|
336 |
public: |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
337 |
GCHeapSummaryEventSender(GCWhen::Type when) : _when(when) {} |
18025 | 338 |
|
339 |
void visit(const GCHeapSummary* heap_summary) const { |
|
340 |
const VirtualSpaceSummary& heap_space = heap_summary->heap(); |
|
341 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
342 |
EventGCHeapSummary e; |
18025 | 343 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
344 |
e.set_gcId(GCId::current()); |
18025 | 345 |
e.set_when((u1)_when); |
346 |
e.set_heapSpace(to_trace_struct(heap_space)); |
|
347 |
e.set_heapUsed(heap_summary->used()); |
|
348 |
e.commit(); |
|
349 |
} |
|
350 |
} |
|
351 |
||
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
352 |
void visit(const G1HeapSummary* g1_heap_summary) const { |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
353 |
visit((GCHeapSummary*)g1_heap_summary); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
354 |
|
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
355 |
EventG1HeapSummary e; |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
356 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
357 |
e.set_gcId(GCId::current()); |
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
358 |
e.set_when((u1)_when); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
359 |
e.set_edenUsedSize(g1_heap_summary->edenUsed()); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
360 |
e.set_edenTotalSize(g1_heap_summary->edenCapacity()); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
361 |
e.set_survivorUsedSize(g1_heap_summary->survivorUsed()); |
36095
2d530b26ae5c
8149648: Add number of regions to the G1HeapSummary event
david
parents:
35204
diff
changeset
|
362 |
e.set_numberOfRegions(g1_heap_summary->numberOfRegions()); |
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
363 |
e.commit(); |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
364 |
} |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
365 |
} |
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
366 |
|
18025 | 367 |
void visit(const PSHeapSummary* ps_heap_summary) const { |
368 |
visit((GCHeapSummary*)ps_heap_summary); |
|
369 |
||
370 |
const VirtualSpaceSummary& old_summary = ps_heap_summary->old(); |
|
371 |
const SpaceSummary& old_space = ps_heap_summary->old_space(); |
|
372 |
const VirtualSpaceSummary& young_summary = ps_heap_summary->young(); |
|
373 |
const SpaceSummary& eden_space = ps_heap_summary->eden(); |
|
374 |
const SpaceSummary& from_space = ps_heap_summary->from(); |
|
375 |
const SpaceSummary& to_space = ps_heap_summary->to(); |
|
376 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
19729
diff
changeset
|
377 |
EventPSHeapSummary e; |
18025 | 378 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
379 |
e.set_gcId(GCId::current()); |
18025 | 380 |
e.set_when((u1)_when); |
381 |
||
382 |
e.set_oldSpace(to_trace_struct(ps_heap_summary->old())); |
|
383 |
e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space())); |
|
384 |
e.set_youngSpace(to_trace_struct(ps_heap_summary->young())); |
|
385 |
e.set_edenSpace(to_trace_struct(ps_heap_summary->eden())); |
|
386 |
e.set_fromSpace(to_trace_struct(ps_heap_summary->from())); |
|
387 |
e.set_toSpace(to_trace_struct(ps_heap_summary->to())); |
|
388 |
e.commit(); |
|
389 |
} |
|
390 |
} |
|
391 |
}; |
|
392 |
||
393 |
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
|
394 |
GCHeapSummaryEventSender visitor(when); |
18025 | 395 |
heap_summary.accept(&visitor); |
396 |
} |
|
397 |
||
398 |
static TraceStructMetaspaceSizes to_trace_struct(const MetaspaceSizes& sizes) { |
|
399 |
TraceStructMetaspaceSizes meta_sizes; |
|
400 |
||
23853
3e1633ff6996
8035667: EventMetaspaceSummary doesn't report committed Metaspace memory
ehelin
parents:
23470
diff
changeset
|
401 |
meta_sizes.set_committed(sizes.committed()); |
18025 | 402 |
meta_sizes.set_used(sizes.used()); |
403 |
meta_sizes.set_reserved(sizes.reserved()); |
|
404 |
||
405 |
return meta_sizes; |
|
406 |
} |
|
407 |
||
408 |
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
|
409 |
EventMetaspaceSummary e; |
18025 | 410 |
if (e.should_commit()) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
411 |
e.set_gcId(GCId::current()); |
18025 | 412 |
e.set_when((u1) when); |
23464
ae470a2efd44
8036696: Add metaspace gc threshold to metaspace summary trace event
ehelin
parents:
21767
diff
changeset
|
413 |
e.set_gcThreshold(meta_space_summary.capacity_until_GC()); |
18025 | 414 |
e.set_metaspace(to_trace_struct(meta_space_summary.meta_space())); |
415 |
e.set_dataSpace(to_trace_struct(meta_space_summary.data_space())); |
|
416 |
e.set_classSpace(to_trace_struct(meta_space_summary.class_space())); |
|
417 |
e.commit(); |
|
418 |
} |
|
419 |
} |
|
420 |
||
421 |
class PhaseSender : public PhaseVisitor { |
|
35204 | 422 |
void visit_pause(GCPhase* phase) { |
423 |
assert(phase->level() < PhasesStack::PHASE_LEVELS, "Need more event types for PausePhase"); |
|
424 |
||
425 |
switch (phase->level()) { |
|
426 |
case 0: send_phase<EventGCPhasePause>(phase); break; |
|
427 |
case 1: send_phase<EventGCPhasePauseLevel1>(phase); break; |
|
428 |
case 2: send_phase<EventGCPhasePauseLevel2>(phase); break; |
|
429 |
case 3: send_phase<EventGCPhasePauseLevel3>(phase); break; |
|
430 |
default: /* Ignore sending this phase */ break; |
|
431 |
} |
|
432 |
} |
|
433 |
||
434 |
void visit_concurrent(GCPhase* phase) { |
|
435 |
assert(phase->level() < 1, "There is only one level for ConcurrentPhase"); |
|
436 |
||
437 |
switch (phase->level()) { |
|
438 |
case 0: send_phase<EventGCPhaseConcurrent>(phase); break; |
|
439 |
default: /* Ignore sending this phase */ break; |
|
440 |
} |
|
441 |
} |
|
442 |
||
18025 | 443 |
public: |
444 |
template<typename T> |
|
35204 | 445 |
void send_phase(GCPhase* phase) { |
18025 | 446 |
T event(UNTIMED); |
447 |
if (event.should_commit()) { |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32380
diff
changeset
|
448 |
event.set_gcId(GCId::current()); |
35204 | 449 |
event.set_name(phase->name()); |
450 |
event.set_starttime(phase->start()); |
|
451 |
event.set_endtime(phase->end()); |
|
18025 | 452 |
event.commit(); |
453 |
} |
|
454 |
} |
|
455 |
||
35204 | 456 |
void visit(GCPhase* phase) { |
457 |
if (phase->type() == GCPhase::PausePhaseType) { |
|
458 |
visit_pause(phase); |
|
459 |
} else { |
|
460 |
assert(phase->type() == GCPhase::ConcurrentPhaseType, "Should be ConcurrentPhaseType"); |
|
461 |
visit_concurrent(phase); |
|
18025 | 462 |
} |
463 |
} |
|
464 |
}; |
|
465 |
||
466 |
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
|
467 |
PhaseSender phase_reporter; |
18025 | 468 |
|
469 |
TimePartitionPhasesIterator iter(time_partitions); |
|
470 |
while (iter.has_next()) { |
|
471 |
GCPhase* phase = iter.next(); |
|
472 |
phase->accept(&phase_reporter); |
|
473 |
} |
|
474 |
} |