26 #include "gc_implementation/shared/gcHeapSummary.hpp" |
26 #include "gc_implementation/shared/gcHeapSummary.hpp" |
27 #include "gc_implementation/shared/gcTimer.hpp" |
27 #include "gc_implementation/shared/gcTimer.hpp" |
28 #include "gc_implementation/shared/gcTrace.hpp" |
28 #include "gc_implementation/shared/gcTrace.hpp" |
29 #include "gc_implementation/shared/gcWhen.hpp" |
29 #include "gc_implementation/shared/gcWhen.hpp" |
30 #include "gc_implementation/shared/copyFailedInfo.hpp" |
30 #include "gc_implementation/shared/copyFailedInfo.hpp" |
|
31 #include "runtime/os.hpp" |
31 #include "trace/tracing.hpp" |
32 #include "trace/tracing.hpp" |
32 #include "trace/traceBackend.hpp" |
33 #include "trace/traceBackend.hpp" |
33 #if INCLUDE_ALL_GCS |
34 #if INCLUDE_ALL_GCS |
34 #include "gc_implementation/g1/evacuationInfo.hpp" |
35 #include "gc_implementation/g1/evacuationInfo.hpp" |
35 #include "gc_implementation/g1/g1YCTypes.hpp" |
36 #include "gc_implementation/g1/g1YCTypes.hpp" |
52 event.commit(); |
53 event.commit(); |
53 } |
54 } |
54 } |
55 } |
55 |
56 |
56 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 { |
57 EventGCReferenceStatistics e; |
58 EventGCReferenceStatistics e(UNTIMED); |
58 if (e.should_commit()) { |
59 if (e.should_commit()) { |
59 e.set_gcId(_shared_gc_info.id()); |
60 e.set_gcId(_shared_gc_info.id()); |
60 e.set_type((u1)type); |
61 e.set_type((u1)type); |
61 e.set_count(count); |
62 e.set_count(count); |
|
63 e.set_endtime(os::elapsed_counter()); |
62 e.commit(); |
64 e.commit(); |
63 } |
65 } |
64 } |
66 } |
65 |
67 |
66 void ParallelOldTracer::send_parallel_old_event() const { |
68 void ParallelOldTracer::send_parallel_old_event() const { |
103 failed_info.set_totalSize(cf_info.total_size()); |
105 failed_info.set_totalSize(cf_info.total_size()); |
104 return failed_info; |
106 return failed_info; |
105 } |
107 } |
106 |
108 |
107 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { |
109 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { |
108 EventPromotionFailed e; |
110 EventPromotionFailed e(UNTIMED); |
109 if (e.should_commit()) { |
111 if (e.should_commit()) { |
110 e.set_gcId(_shared_gc_info.id()); |
112 e.set_gcId(_shared_gc_info.id()); |
111 e.set_data(to_trace_struct(pf_info)); |
113 e.set_data(to_trace_struct(pf_info)); |
112 e.set_thread(pf_info.thread()->thread_id()); |
114 e.set_thread(pf_info.thread()->thread_id()); |
|
115 e.set_endtime(os::elapsed_counter()); |
113 e.commit(); |
116 e.commit(); |
114 } |
117 } |
115 } |
118 } |
116 |
119 |
117 // Common to CMS and G1 |
120 // Common to CMS and G1 |
118 void OldGCTracer::send_concurrent_mode_failure_event() { |
121 void OldGCTracer::send_concurrent_mode_failure_event() { |
119 EventConcurrentModeFailure e; |
122 EventConcurrentModeFailure e(UNTIMED); |
120 if (e.should_commit()) { |
123 if (e.should_commit()) { |
121 e.set_gcId(_shared_gc_info.id()); |
124 e.set_gcId(_shared_gc_info.id()); |
|
125 e.set_endtime(os::elapsed_counter()); |
122 e.commit(); |
126 e.commit(); |
123 } |
127 } |
124 } |
128 } |
125 |
129 |
126 #if INCLUDE_ALL_GCS |
130 #if INCLUDE_ALL_GCS |
134 e.commit(); |
138 e.commit(); |
135 } |
139 } |
136 } |
140 } |
137 |
141 |
138 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) { |
142 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) { |
139 EventEvacuationInfo e; |
143 EventEvacuationInfo e(UNTIMED); |
140 if (e.should_commit()) { |
144 if (e.should_commit()) { |
141 e.set_gcId(_shared_gc_info.id()); |
145 e.set_gcId(_shared_gc_info.id()); |
142 e.set_cSetRegions(info->collectionset_regions()); |
146 e.set_cSetRegions(info->collectionset_regions()); |
143 e.set_cSetUsedBefore(info->collectionset_used_before()); |
147 e.set_cSetUsedBefore(info->collectionset_used_before()); |
144 e.set_cSetUsedAfter(info->collectionset_used_after()); |
148 e.set_cSetUsedAfter(info->collectionset_used_after()); |
145 e.set_allocationRegions(info->allocation_regions()); |
149 e.set_allocationRegions(info->allocation_regions()); |
146 e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); |
150 e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); |
147 e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied()); |
151 e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied()); |
148 e.set_bytesCopied(info->bytes_copied()); |
152 e.set_bytesCopied(info->bytes_copied()); |
149 e.set_regionsFreed(info->regions_freed()); |
153 e.set_regionsFreed(info->regions_freed()); |
|
154 e.set_endtime(os::elapsed_counter()); |
150 e.commit(); |
155 e.commit(); |
151 } |
156 } |
152 } |
157 } |
153 |
158 |
154 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const { |
159 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const { |
155 EventEvacuationFailed e; |
160 EventEvacuationFailed e(UNTIMED); |
156 if (e.should_commit()) { |
161 if (e.should_commit()) { |
157 e.set_gcId(_shared_gc_info.id()); |
162 e.set_gcId(_shared_gc_info.id()); |
158 e.set_data(to_trace_struct(ef_info)); |
163 e.set_data(to_trace_struct(ef_info)); |
|
164 e.set_endtime(os::elapsed_counter()); |
159 e.commit(); |
165 e.commit(); |
160 } |
166 } |
161 } |
167 } |
162 #endif |
168 #endif |
163 |
169 |
187 GCHeapSummaryEventSender(GCId id, GCWhen::Type when) : _id(id), _when(when) {} |
193 GCHeapSummaryEventSender(GCId id, GCWhen::Type when) : _id(id), _when(when) {} |
188 |
194 |
189 void visit(const GCHeapSummary* heap_summary) const { |
195 void visit(const GCHeapSummary* heap_summary) const { |
190 const VirtualSpaceSummary& heap_space = heap_summary->heap(); |
196 const VirtualSpaceSummary& heap_space = heap_summary->heap(); |
191 |
197 |
192 EventGCHeapSummary e; |
198 EventGCHeapSummary e(UNTIMED); |
193 if (e.should_commit()) { |
199 if (e.should_commit()) { |
194 e.set_gcId(_id); |
200 e.set_gcId(_id); |
195 e.set_when((u1)_when); |
201 e.set_when((u1)_when); |
196 e.set_heapSpace(to_trace_struct(heap_space)); |
202 e.set_heapSpace(to_trace_struct(heap_space)); |
197 e.set_heapUsed(heap_summary->used()); |
203 e.set_heapUsed(heap_summary->used()); |
|
204 e.set_endtime(os::elapsed_counter()); |
198 e.commit(); |
205 e.commit(); |
199 } |
206 } |
200 } |
207 } |
201 |
208 |
202 void visit(const PSHeapSummary* ps_heap_summary) const { |
209 void visit(const PSHeapSummary* ps_heap_summary) const { |
207 const VirtualSpaceSummary& young_summary = ps_heap_summary->young(); |
214 const VirtualSpaceSummary& young_summary = ps_heap_summary->young(); |
208 const SpaceSummary& eden_space = ps_heap_summary->eden(); |
215 const SpaceSummary& eden_space = ps_heap_summary->eden(); |
209 const SpaceSummary& from_space = ps_heap_summary->from(); |
216 const SpaceSummary& from_space = ps_heap_summary->from(); |
210 const SpaceSummary& to_space = ps_heap_summary->to(); |
217 const SpaceSummary& to_space = ps_heap_summary->to(); |
211 |
218 |
212 EventPSHeapSummary e; |
219 EventPSHeapSummary e(UNTIMED); |
213 if (e.should_commit()) { |
220 if (e.should_commit()) { |
214 e.set_gcId(_id); |
221 e.set_gcId(_id); |
215 e.set_when((u1)_when); |
222 e.set_when((u1)_when); |
216 |
223 |
217 e.set_oldSpace(to_trace_struct(ps_heap_summary->old())); |
224 e.set_oldSpace(to_trace_struct(ps_heap_summary->old())); |
218 e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space())); |
225 e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space())); |
219 e.set_youngSpace(to_trace_struct(ps_heap_summary->young())); |
226 e.set_youngSpace(to_trace_struct(ps_heap_summary->young())); |
220 e.set_edenSpace(to_trace_struct(ps_heap_summary->eden())); |
227 e.set_edenSpace(to_trace_struct(ps_heap_summary->eden())); |
221 e.set_fromSpace(to_trace_struct(ps_heap_summary->from())); |
228 e.set_fromSpace(to_trace_struct(ps_heap_summary->from())); |
222 e.set_toSpace(to_trace_struct(ps_heap_summary->to())); |
229 e.set_toSpace(to_trace_struct(ps_heap_summary->to())); |
|
230 e.set_endtime(os::elapsed_counter()); |
223 e.commit(); |
231 e.commit(); |
224 } |
232 } |
225 } |
233 } |
226 }; |
234 }; |
227 |
235 |
239 |
247 |
240 return meta_sizes; |
248 return meta_sizes; |
241 } |
249 } |
242 |
250 |
243 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const { |
251 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const { |
244 EventMetaspaceSummary e; |
252 EventMetaspaceSummary e(UNTIMED); |
245 if (e.should_commit()) { |
253 if (e.should_commit()) { |
246 e.set_gcId(_shared_gc_info.id()); |
254 e.set_gcId(_shared_gc_info.id()); |
247 e.set_when((u1) when); |
255 e.set_when((u1) when); |
248 e.set_metaspace(to_trace_struct(meta_space_summary.meta_space())); |
256 e.set_metaspace(to_trace_struct(meta_space_summary.meta_space())); |
249 e.set_dataSpace(to_trace_struct(meta_space_summary.data_space())); |
257 e.set_dataSpace(to_trace_struct(meta_space_summary.data_space())); |
250 e.set_classSpace(to_trace_struct(meta_space_summary.class_space())); |
258 e.set_classSpace(to_trace_struct(meta_space_summary.class_space())); |
|
259 e.set_endtime(os::elapsed_counter()); |
251 e.commit(); |
260 e.commit(); |
252 } |
261 } |
253 } |
262 } |
254 |
263 |
255 class PhaseSender : public PhaseVisitor { |
264 class PhaseSender : public PhaseVisitor { |
280 case 2: send_phase<EventGCPhasePauseLevel2>(pause); break; |
289 case 2: send_phase<EventGCPhasePauseLevel2>(pause); break; |
281 case 3: send_phase<EventGCPhasePauseLevel3>(pause); break; |
290 case 3: send_phase<EventGCPhasePauseLevel3>(pause); break; |
282 default: /* Ignore sending this phase */ break; |
291 default: /* Ignore sending this phase */ break; |
283 } |
292 } |
284 } |
293 } |
285 |
|
286 #undef send_phase |
|
287 }; |
294 }; |
288 |
295 |
289 void GCTracer::send_phase_events(TimePartitions* time_partitions) const { |
296 void GCTracer::send_phase_events(TimePartitions* time_partitions) const { |
290 PhaseSender phase_reporter(_shared_gc_info.id()); |
297 PhaseSender phase_reporter(_shared_gc_info.id()); |
291 |
298 |