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"
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"
31 #include "runtime/os.hpp"
32 #include "trace/traceBackend.hpp"
33 #include "trace/tracing.hpp"
34 #include "utilities/macros.hpp"
35 #if INCLUDE_ALL_GCS
36 #include "gc/g1/evacuationInfo.hpp"
37 #include "gc/g1/g1YCTypes.hpp"
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()) {
47 event.set_gcId(GCId::current());
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
248 s.set_failureUsed(summary.failure_used() * HeapWordSize);
249 s.set_failureWaste(summary.failure_waste() * HeapWordSize);
250 return s;
251 }
252
253 void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const {
254 EventGCG1EvacuationYoungStatistics surv_evt;
255 if (surv_evt.should_commit()) {
256 surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
257 surv_evt.commit();
258 }
259 }
260
261 void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const {
262 EventGCG1EvacuationOldStatistics old_evt;
263 if (old_evt.should_commit()) {
264 old_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
265 old_evt.commit();
266 }
267 }
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 }
|
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"
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"
31 #include "runtime/os.hpp"
32 #include "trace/traceBackend.hpp"
33 #include "trace/tracing.hpp"
34 #include "utilities/macros.hpp"
35 #if INCLUDE_ALL_GCS
36 #include "gc/g1/evacuationInfo.hpp"
37 #include "gc/g1/g1YCTypes.hpp"
38 #include "tracefiles/traceEventClasses.hpp"
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()) {
48 event.set_gcId(GCId::current());
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
249 s.set_failureUsed(summary.failure_used() * HeapWordSize);
250 s.set_failureWaste(summary.failure_waste() * HeapWordSize);
251 return s;
252 }
253
254 void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const {
255 EventGCG1EvacuationYoungStatistics surv_evt;
256 if (surv_evt.should_commit()) {
257 surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
258 surv_evt.commit();
259 }
260 }
261
262 void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const {
263 EventGCG1EvacuationOldStatistics old_evt;
264 if (old_evt.should_commit()) {
265 old_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
266 old_evt.commit();
267 }
268 }
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);
281 evt.set_thresholdPercentage(target_occupancy > 0 ? threshold * 100.0 / target_occupancy : 0.0);
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 additional_buffer_size,
292 double predicted_allocation_rate,
293 double predicted_marking_length,
294 bool prediction_active) {
295 EventGCG1AdaptiveIHOP evt;
296 if (evt.should_commit()) {
297 evt.set_gcId(GCId::current());
298 evt.set_additionalBufferSize(additional_buffer_size);
299 evt.set_predictedAllocationRate(predicted_allocation_rate);
300 evt.set_predictedMarkingLength(predicted_marking_length);
301 evt.set_predictionActive(prediction_active);
302 evt.commit();
303 }
304 }
305
306 #endif
307
308 static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) {
309 TraceStructVirtualSpace space;
310 space.set_start((TraceAddress)summary.start());
311 space.set_committedEnd((TraceAddress)summary.committed_end());
312 space.set_committedSize(summary.committed_size());
313 space.set_reservedEnd((TraceAddress)summary.reserved_end());
314 space.set_reservedSize(summary.reserved_size());
315 return space;
316 }
317
318 static TraceStructObjectSpace to_trace_struct(const SpaceSummary& summary) {
319 TraceStructObjectSpace space;
320 space.set_start((TraceAddress)summary.start());
321 space.set_end((TraceAddress)summary.end());
322 space.set_used(summary.used());
323 space.set_size(summary.size());
324 return space;
325 }
|