Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/shared/gcTraceSend.cpp @ 13400:86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
Reviewed-by: dholmes, egahlin
author | mgronlun |
---|---|
date | Sat, 23 Nov 2013 12:25:13 +0100 |
parents | f175e3678be2 |
children | 537c8e21b118 |
comparison
equal
deleted
inserted
replaced
13399:260ac69dc096 | 13400:86e6d691f2e1 |
---|---|
53 event.commit(); | 53 event.commit(); |
54 } | 54 } |
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(UNTIMED); | 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.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.set_endtime(os::elapsed_counter()); | |
64 e.commit(); | 63 e.commit(); |
65 } | 64 } |
66 } | 65 } |
67 | 66 |
68 void ParallelOldTracer::send_parallel_old_event() const { | 67 void ParallelOldTracer::send_parallel_old_event() const { |
105 failed_info.set_totalSize(cf_info.total_size()); | 104 failed_info.set_totalSize(cf_info.total_size()); |
106 return failed_info; | 105 return failed_info; |
107 } | 106 } |
108 | 107 |
109 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { | 108 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const { |
110 EventPromotionFailed e(UNTIMED); | 109 EventPromotionFailed e; |
111 if (e.should_commit()) { | 110 if (e.should_commit()) { |
112 e.set_gcId(_shared_gc_info.id()); | 111 e.set_gcId(_shared_gc_info.id()); |
113 e.set_data(to_trace_struct(pf_info)); | 112 e.set_data(to_trace_struct(pf_info)); |
114 e.set_thread(pf_info.thread()->thread_id()); | 113 e.set_thread(pf_info.thread()->thread_id()); |
115 e.set_endtime(os::elapsed_counter()); | |
116 e.commit(); | 114 e.commit(); |
117 } | 115 } |
118 } | 116 } |
119 | 117 |
120 // Common to CMS and G1 | 118 // Common to CMS and G1 |
121 void OldGCTracer::send_concurrent_mode_failure_event() { | 119 void OldGCTracer::send_concurrent_mode_failure_event() { |
122 EventConcurrentModeFailure e(UNTIMED); | 120 EventConcurrentModeFailure e; |
123 if (e.should_commit()) { | 121 if (e.should_commit()) { |
124 e.set_gcId(_shared_gc_info.id()); | 122 e.set_gcId(_shared_gc_info.id()); |
125 e.set_endtime(os::elapsed_counter()); | |
126 e.commit(); | 123 e.commit(); |
127 } | 124 } |
128 } | 125 } |
129 | 126 |
130 #if INCLUDE_ALL_GCS | 127 #if INCLUDE_ALL_GCS |
138 e.commit(); | 135 e.commit(); |
139 } | 136 } |
140 } | 137 } |
141 | 138 |
142 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) { | 139 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) { |
143 EventEvacuationInfo e(UNTIMED); | 140 EventEvacuationInfo e; |
144 if (e.should_commit()) { | 141 if (e.should_commit()) { |
145 e.set_gcId(_shared_gc_info.id()); | 142 e.set_gcId(_shared_gc_info.id()); |
146 e.set_cSetRegions(info->collectionset_regions()); | 143 e.set_cSetRegions(info->collectionset_regions()); |
147 e.set_cSetUsedBefore(info->collectionset_used_before()); | 144 e.set_cSetUsedBefore(info->collectionset_used_before()); |
148 e.set_cSetUsedAfter(info->collectionset_used_after()); | 145 e.set_cSetUsedAfter(info->collectionset_used_after()); |
149 e.set_allocationRegions(info->allocation_regions()); | 146 e.set_allocationRegions(info->allocation_regions()); |
150 e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); | 147 e.set_allocRegionsUsedBefore(info->alloc_regions_used_before()); |
151 e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied()); | 148 e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied()); |
152 e.set_bytesCopied(info->bytes_copied()); | 149 e.set_bytesCopied(info->bytes_copied()); |
153 e.set_regionsFreed(info->regions_freed()); | 150 e.set_regionsFreed(info->regions_freed()); |
154 e.set_endtime(os::elapsed_counter()); | |
155 e.commit(); | 151 e.commit(); |
156 } | 152 } |
157 } | 153 } |
158 | 154 |
159 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const { | 155 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const { |
160 EventEvacuationFailed e(UNTIMED); | 156 EventEvacuationFailed e; |
161 if (e.should_commit()) { | 157 if (e.should_commit()) { |
162 e.set_gcId(_shared_gc_info.id()); | 158 e.set_gcId(_shared_gc_info.id()); |
163 e.set_data(to_trace_struct(ef_info)); | 159 e.set_data(to_trace_struct(ef_info)); |
164 e.set_endtime(os::elapsed_counter()); | |
165 e.commit(); | 160 e.commit(); |
166 } | 161 } |
167 } | 162 } |
168 #endif | 163 #endif |
169 | 164 |
193 GCHeapSummaryEventSender(GCId id, GCWhen::Type when) : _id(id), _when(when) {} | 188 GCHeapSummaryEventSender(GCId id, GCWhen::Type when) : _id(id), _when(when) {} |
194 | 189 |
195 void visit(const GCHeapSummary* heap_summary) const { | 190 void visit(const GCHeapSummary* heap_summary) const { |
196 const VirtualSpaceSummary& heap_space = heap_summary->heap(); | 191 const VirtualSpaceSummary& heap_space = heap_summary->heap(); |
197 | 192 |
198 EventGCHeapSummary e(UNTIMED); | 193 EventGCHeapSummary e; |
199 if (e.should_commit()) { | 194 if (e.should_commit()) { |
200 e.set_gcId(_id); | 195 e.set_gcId(_id); |
201 e.set_when((u1)_when); | 196 e.set_when((u1)_when); |
202 e.set_heapSpace(to_trace_struct(heap_space)); | 197 e.set_heapSpace(to_trace_struct(heap_space)); |
203 e.set_heapUsed(heap_summary->used()); | 198 e.set_heapUsed(heap_summary->used()); |
204 e.set_endtime(os::elapsed_counter()); | |
205 e.commit(); | 199 e.commit(); |
206 } | 200 } |
207 } | 201 } |
208 | 202 |
209 void visit(const PSHeapSummary* ps_heap_summary) const { | 203 void visit(const PSHeapSummary* ps_heap_summary) const { |
214 const VirtualSpaceSummary& young_summary = ps_heap_summary->young(); | 208 const VirtualSpaceSummary& young_summary = ps_heap_summary->young(); |
215 const SpaceSummary& eden_space = ps_heap_summary->eden(); | 209 const SpaceSummary& eden_space = ps_heap_summary->eden(); |
216 const SpaceSummary& from_space = ps_heap_summary->from(); | 210 const SpaceSummary& from_space = ps_heap_summary->from(); |
217 const SpaceSummary& to_space = ps_heap_summary->to(); | 211 const SpaceSummary& to_space = ps_heap_summary->to(); |
218 | 212 |
219 EventPSHeapSummary e(UNTIMED); | 213 EventPSHeapSummary e; |
220 if (e.should_commit()) { | 214 if (e.should_commit()) { |
221 e.set_gcId(_id); | 215 e.set_gcId(_id); |
222 e.set_when((u1)_when); | 216 e.set_when((u1)_when); |
223 | 217 |
224 e.set_oldSpace(to_trace_struct(ps_heap_summary->old())); | 218 e.set_oldSpace(to_trace_struct(ps_heap_summary->old())); |
225 e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space())); | 219 e.set_oldObjectSpace(to_trace_struct(ps_heap_summary->old_space())); |
226 e.set_youngSpace(to_trace_struct(ps_heap_summary->young())); | 220 e.set_youngSpace(to_trace_struct(ps_heap_summary->young())); |
227 e.set_edenSpace(to_trace_struct(ps_heap_summary->eden())); | 221 e.set_edenSpace(to_trace_struct(ps_heap_summary->eden())); |
228 e.set_fromSpace(to_trace_struct(ps_heap_summary->from())); | 222 e.set_fromSpace(to_trace_struct(ps_heap_summary->from())); |
229 e.set_toSpace(to_trace_struct(ps_heap_summary->to())); | 223 e.set_toSpace(to_trace_struct(ps_heap_summary->to())); |
230 e.set_endtime(os::elapsed_counter()); | |
231 e.commit(); | 224 e.commit(); |
232 } | 225 } |
233 } | 226 } |
234 }; | 227 }; |
235 | 228 |
247 | 240 |
248 return meta_sizes; | 241 return meta_sizes; |
249 } | 242 } |
250 | 243 |
251 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const { | 244 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const { |
252 EventMetaspaceSummary e(UNTIMED); | 245 EventMetaspaceSummary e; |
253 if (e.should_commit()) { | 246 if (e.should_commit()) { |
254 e.set_gcId(_shared_gc_info.id()); | 247 e.set_gcId(_shared_gc_info.id()); |
255 e.set_when((u1) when); | 248 e.set_when((u1) when); |
256 e.set_metaspace(to_trace_struct(meta_space_summary.meta_space())); | 249 e.set_metaspace(to_trace_struct(meta_space_summary.meta_space())); |
257 e.set_dataSpace(to_trace_struct(meta_space_summary.data_space())); | 250 e.set_dataSpace(to_trace_struct(meta_space_summary.data_space())); |
258 e.set_classSpace(to_trace_struct(meta_space_summary.class_space())); | 251 e.set_classSpace(to_trace_struct(meta_space_summary.class_space())); |
259 e.set_endtime(os::elapsed_counter()); | |
260 e.commit(); | 252 e.commit(); |
261 } | 253 } |
262 } | 254 } |
263 | 255 |
264 class PhaseSender : public PhaseVisitor { | 256 class PhaseSender : public PhaseVisitor { |