Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/shared/gcTraceSend.cpp @ 20190:0982ec23da03
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
Reviewed-by: jwilhelm, ehelin, tschatzl
author | brutisso |
---|---|
date | Thu, 19 Jun 2014 13:31:14 +0200 |
parents | fa21c9537e6e |
children |
comparison
equal
deleted
inserted
replaced
20189:5d855d021755 | 20190:0982ec23da03 |
---|---|
41 typedef uintptr_t TraceAddress; | 41 typedef uintptr_t TraceAddress; |
42 | 42 |
43 void GCTracer::send_garbage_collection_event() const { | 43 void GCTracer::send_garbage_collection_event() const { |
44 EventGCGarbageCollection event(UNTIMED); | 44 EventGCGarbageCollection event(UNTIMED); |
45 if (event.should_commit()) { | 45 if (event.should_commit()) { |
46 event.set_gcId(_shared_gc_info.id()); | 46 event.set_gcId(_shared_gc_info.gc_id().id()); |
47 event.set_name(_shared_gc_info.name()); | 47 event.set_name(_shared_gc_info.name()); |
48 event.set_cause((u2) _shared_gc_info.cause()); | 48 event.set_cause((u2) _shared_gc_info.cause()); |
49 event.set_sumOfPauses(_shared_gc_info.sum_of_pauses()); | 49 event.set_sumOfPauses(_shared_gc_info.sum_of_pauses()); |
50 event.set_longestPause(_shared_gc_info.longest_pause()); | 50 event.set_longestPause(_shared_gc_info.longest_pause()); |
51 event.set_starttime(_shared_gc_info.start_timestamp()); | 51 event.set_starttime(_shared_gc_info.start_timestamp()); |
55 } | 55 } |
56 | 56 |
57 void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const { | 57 void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const { |
58 EventGCReferenceStatistics e; | 58 EventGCReferenceStatistics e; |
59 if (e.should_commit()) { | 59 if (e.should_commit()) { |
60 e.set_gcId(_shared_gc_info.id()); | 60 e.set_gcId(_shared_gc_info.gc_id().id()); |
61 e.set_type((u1)type); | 61 e.set_type((u1)type); |
62 e.set_count(count); | 62 e.set_count(count); |
63 e.commit(); | 63 e.commit(); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, | 67 void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, |
68 const MetaspaceChunkFreeListSummary& summary) const { | 68 const MetaspaceChunkFreeListSummary& summary) const { |
69 EventMetaspaceChunkFreeListSummary e; | 69 EventMetaspaceChunkFreeListSummary e; |
70 if (e.should_commit()) { | 70 if (e.should_commit()) { |
71 e.set_gcId(_shared_gc_info.id()); | 71 e.set_gcId(_shared_gc_info.gc_id().id()); |
72 e.set_when(when); | 72 e.set_when(when); |
73 e.set_metadataType(mdtype); | 73 e.set_metadataType(mdtype); |
74 | 74 |
75 e.set_specializedChunks(summary.num_specialized_chunks()); | 75 e.set_specializedChunks(summary.num_specialized_chunks()); |
76 e.set_specializedChunksTotalSize(summary.specialized_chunks_size_in_bytes()); | 76 e.set_specializedChunksTotalSize(summary.specialized_chunks_size_in_bytes()); |
89 } | 89 } |
90 | 90 |
91 void ParallelOldTracer::send_parallel_old_event() const { | 91 void ParallelOldTracer::send_parallel_old_event() const { |
92 EventGCParallelOld e(UNTIMED); | 92 EventGCParallelOld e(UNTIMED); |
93 if (e.should_commit()) { | 93 if (e.should_commit()) { |
94 e.set_gcId(_shared_gc_info.id()); | 94 e.set_gcId(_shared_gc_info.gc_id().id()); |
95 e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix()); | 95 e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix()); |
96 e.set_starttime(_shared_gc_info.start_timestamp()); | 96 e.set_starttime(_shared_gc_info.start_timestamp()); |
97 e.set_endtime(_shared_gc_info.end_timestamp()); | 97 e.set_endtime(_shared_gc_info.end_timestamp()); |
98 e.commit(); | 98 e.commit(); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 void YoungGCTracer::send_young_gc_event() const { | 102 void YoungGCTracer::send_young_gc_event() const { |
103 EventGCYoungGarbageCollection e(UNTIMED); | 103 EventGCYoungGarbageCollection e(UNTIMED); |
104 if (e.should_commit()) { | 104 if (e.should_commit()) { |
105 e.set_gcId(_shared_gc_info.id()); | 105 e.set_gcId(_shared_gc_info.gc_id().id()); |
106 e.set_tenuringThreshold(_tenuring_threshold); | 106 e.set_tenuringThreshold(_tenuring_threshold); |
107 e.set_starttime(_shared_gc_info.start_timestamp()); | 107 e.set_starttime(_shared_gc_info.start_timestamp()); |
108 e.set_endtime(_shared_gc_info.end_timestamp()); | 108 e.set_endtime(_shared_gc_info.end_timestamp()); |
109 e.commit(); | 109 e.commit(); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 void OldGCTracer::send_old_gc_event() const { | 113 void OldGCTracer::send_old_gc_event() const { |
114 EventGCOldGarbageCollection e(UNTIMED); | 114 EventGCOldGarbageCollection e(UNTIMED); |
115 if (e.should_commit()) { | 115 if (e.should_commit()) { |
116 e.set_gcId(_shared_gc_info.id()); | 116 e.set_gcId(_shared_gc_info.gc_id().id()); |
117 e.set_starttime(_shared_gc_info.start_timestamp()); | 117 e.set_starttime(_shared_gc_info.start_timestamp()); |
118 e.set_endtime(_shared_gc_info.end_timestamp()); | 118 e.set_endtime(_shared_gc_info.end_timestamp()); |
119 e.commit(); | 119 e.commit(); |
120 } | 120 } |
121 } | 121 } |
130 } | 130 } |
131 | 131 |
132 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { | 132 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { |
133 EventPromotionFailed e; | 133 EventPromotionFailed e; |
134 if (e.should_commit()) { | 134 if (e.should_commit()) { |
135 e.set_gcId(_shared_gc_info.id()); | 135 e.set_gcId(_shared_gc_info.gc_id().id()); |
136 e.set_data(to_trace_struct(pf_info)); | 136 e.set_data(to_trace_struct(pf_info)); |
137 e.set_thread(pf_info.thread()->thread_id()); | 137 e.set_thread(pf_info.thread()->thread_id()); |
138 e.commit(); | 138 e.commit(); |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 // Common to CMS and G1 | 142 // Common to CMS and G1 |
143 void OldGCTracer::send_concurrent_mode_failure_event() { | 143 void OldGCTracer::send_concurrent_mode_failure_event() { |
144 EventConcurrentModeFailure e; | 144 EventConcurrentModeFailure e; |
145 if (e.should_commit()) { | 145 if (e.should_commit()) { |
146 e.set_gcId(_shared_gc_info.id()); | 146 e.set_gcId(_shared_gc_info.gc_id().id()); |
147 e.commit(); | 147 e.commit(); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 #if INCLUDE_ALL_GCS | 151 #if INCLUDE_ALL_GCS |
152 void G1NewTracer::send_g1_young_gc_event() { | 152 void G1NewTracer::send_g1_young_gc_event() { |
153 EventGCG1GarbageCollection e(UNTIMED); | 153 EventGCG1GarbageCollection e(UNTIMED); |
154 if (e.should_commit()) { | 154 if (e.should_commit()) { |
155 e.set_gcId(_shared_gc_info.id()); | 155 e.set_gcId(_shared_gc_info.gc_id().id()); |
156 e.set_type(_g1_young_gc_info.type()); | 156 e.set_type(_g1_young_gc_info.type()); |
157 e.set_starttime(_shared_gc_info.start_timestamp()); | 157 e.set_starttime(_shared_gc_info.start_timestamp()); |
158 e.set_endtime(_shared_gc_info.end_timestamp()); | 158 e.set_endtime(_shared_gc_info.end_timestamp()); |
159 e.commit(); | 159 e.commit(); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) { | 163 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) { |
164 EventEvacuationInfo e; | 164 EventEvacuationInfo e; |
165 if (e.should_commit()) { | 165 if (e.should_commit()) { |
166 e.set_gcId(_shared_gc_info.id()); | 166 e.set_gcId(_shared_gc_info.gc_id().id()); |
167 e.set_cSetRegions(info->collectionset_regions()); | 167 e.set_cSetRegions(info->collectionset_regions()); |
168 e.set_cSetUsedBefore(info->collectionset_used_before()); | 168 e.set_cSetUsedBefore(info->collectionset_used_before()); |
169 e.set_cSetUsedAfter(info->collectionset_used_after()); | 169 e.set_cSetUsedAfter(info->collectionset_used_after()); |
170 e.set_allocationRegions(info->allocation_regions()); | 170 e.set_allocationRegions(info->allocation_regions()); |
171 e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); | 171 e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); |
177 } | 177 } |
178 | 178 |
179 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const { | 179 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const { |
180 EventEvacuationFailed e; | 180 EventEvacuationFailed e; |
181 if (e.should_commit()) { | 181 if (e.should_commit()) { |
182 e.set_gcId(_shared_gc_info.id()); | 182 e.set_gcId(_shared_gc_info.gc_id().id()); |
183 e.set_data(to_trace_struct(ef_info)); | 183 e.set_data(to_trace_struct(ef_info)); |
184 e.commit(); | 184 e.commit(); |
185 } | 185 } |
186 } | 186 } |
187 #endif | 187 #endif |
204 space.set_size(summary.size()); | 204 space.set_size(summary.size()); |
205 return space; | 205 return space; |
206 } | 206 } |
207 | 207 |
208 class GCHeapSummaryEventSender : public GCHeapSummaryVisitor { | 208 class GCHeapSummaryEventSender : public GCHeapSummaryVisitor { |
209 GCId _id; | 209 GCId _gc_id; |
210 GCWhen::Type _when; | 210 GCWhen::Type _when; |
211 public: | 211 public: |
212 GCHeapSummaryEventSender(GCId id, GCWhen::Type when) : _id(id), _when(when) {} | 212 GCHeapSummaryEventSender(GCId gc_id, GCWhen::Type when) : _gc_id(gc_id), _when(when) {} |
213 | 213 |
214 void visit(const GCHeapSummary* heap_summary) const { | 214 void visit(const GCHeapSummary* heap_summary) const { |
215 const VirtualSpaceSummary& heap_space = heap_summary->heap(); | 215 const VirtualSpaceSummary& heap_space = heap_summary->heap(); |
216 | 216 |
217 EventGCHeapSummary e; | 217 EventGCHeapSummary e; |
218 if (e.should_commit()) { | 218 if (e.should_commit()) { |
219 e.set_gcId(_id); | 219 e.set_gcId(_gc_id.id()); |
220 e.set_when((u1)_when); | 220 e.set_when((u1)_when); |
221 e.set_heapSpace(to_trace_struct(heap_space)); | 221 e.set_heapSpace(to_trace_struct(heap_space)); |
222 e.set_heapUsed(heap_summary->used()); | 222 e.set_heapUsed(heap_summary->used()); |
223 e.commit(); | 223 e.commit(); |
224 } | 224 } |
234 const SpaceSummary& from_space = ps_heap_summary->from(); | 234 const SpaceSummary& from_space = ps_heap_summary->from(); |
235 const SpaceSummary& to_space = ps_heap_summary->to(); | 235 const SpaceSummary& to_space = ps_heap_summary->to(); |
236 | 236 |
237 EventPSHeapSummary e; | 237 EventPSHeapSummary e; |
238 if (e.should_commit()) { | 238 if (e.should_commit()) { |
239 e.set_gcId(_id); | 239 e.set_gcId(_gc_id.id()); |
240 e.set_when((u1)_when); | 240 e.set_when((u1)_when); |
241 | 241 |
242 e.set_oldSpace(to_trace_struct(ps_heap_summary->old())); | 242 e.set_oldSpace(to_trace_struct(ps_heap_summary->old())); |
243 e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space())); | 243 e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space())); |
244 e.set_youngSpace(to_trace_struct(ps_heap_summary->young())); | 244 e.set_youngSpace(to_trace_struct(ps_heap_summary->young())); |
249 } | 249 } |
250 } | 250 } |
251 }; | 251 }; |
252 | 252 |
253 void GCTracer::send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const { | 253 void GCTracer::send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const { |
254 GCHeapSummaryEventSender visitor(_shared_gc_info.id(), when); | 254 GCHeapSummaryEventSender visitor(_shared_gc_info.gc_id(), when); |
255 heap_summary.accept(&visitor); | 255 heap_summary.accept(&visitor); |
256 } | 256 } |
257 | 257 |
258 static TraceStructMetaspaceSizes to_trace_struct(const MetaspaceSizes& sizes) { | 258 static TraceStructMetaspaceSizes to_trace_struct(const MetaspaceSizes& sizes) { |
259 TraceStructMetaspaceSizes meta_sizes; | 259 TraceStructMetaspaceSizes meta_sizes; |
266 } | 266 } |
267 | 267 |
268 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const { | 268 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const { |
269 EventMetaspaceSummary e; | 269 EventMetaspaceSummary e; |
270 if (e.should_commit()) { | 270 if (e.should_commit()) { |
271 e.set_gcId(_shared_gc_info.id()); | 271 e.set_gcId(_shared_gc_info.gc_id().id()); |
272 e.set_when((u1) when); | 272 e.set_when((u1) when); |
273 e.set_gcThreshold(meta_space_summary.capacity_until_GC()); | 273 e.set_gcThreshold(meta_space_summary.capacity_until_GC()); |
274 e.set_metaspace(to_trace_struct(meta_space_summary.meta_space())); | 274 e.set_metaspace(to_trace_struct(meta_space_summary.meta_space())); |
275 e.set_dataSpace(to_trace_struct(meta_space_summary.data_space())); | 275 e.set_dataSpace(to_trace_struct(meta_space_summary.data_space())); |
276 e.set_classSpace(to_trace_struct(meta_space_summary.class_space())); | 276 e.set_classSpace(to_trace_struct(meta_space_summary.class_space())); |
285 | 285 |
286 template<typename T> | 286 template<typename T> |
287 void send_phase(PausePhase* pause) { | 287 void send_phase(PausePhase* pause) { |
288 T event(UNTIMED); | 288 T event(UNTIMED); |
289 if (event.should_commit()) { | 289 if (event.should_commit()) { |
290 event.set_gcId(_gc_id); | 290 event.set_gcId(_gc_id.id()); |
291 event.set_name(pause->name()); | 291 event.set_name(pause->name()); |
292 event.set_starttime(pause->start()); | 292 event.set_starttime(pause->start()); |
293 event.set_endtime(pause->end()); | 293 event.set_endtime(pause->end()); |
294 event.commit(); | 294 event.commit(); |
295 } | 295 } |
309 } | 309 } |
310 } | 310 } |
311 }; | 311 }; |
312 | 312 |
313 void GCTracer::send_phase_events(TimePartitions* time_partitions) const { | 313 void GCTracer::send_phase_events(TimePartitions* time_partitions) const { |
314 PhaseSender phase_reporter(_shared_gc_info.id()); | 314 PhaseSender phase_reporter(_shared_gc_info.gc_id()); |
315 | 315 |
316 TimePartitionPhasesIterator iter(time_partitions); | 316 TimePartitionPhasesIterator iter(time_partitions); |
317 while (iter.has_next()) { | 317 while (iter.has_next()) { |
318 GCPhase* phase = iter.next(); | 318 GCPhase* phase = iter.next(); |
319 phase->accept(&phase_reporter); | 319 phase->accept(&phase_reporter); |