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"
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 EventGarbageCollection 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
171
172 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
173 EventPromotionFailed e;
174 if (e.should_commit()) {
175 e.set_gcId(GCId::current());
176 e.set_promotionFailed(to_trace_struct(pf_info));
177 e.set_thread(pf_info.thread_trace_id());
178 e.commit();
179 }
180 }
181
182 // Common to CMS and G1
183 void OldGCTracer::send_concurrent_mode_failure_event() {
184 EventConcurrentModeFailure e;
185 if (e.should_commit()) {
186 e.set_gcId(GCId::current());
187 e.commit();
188 }
189 }
190
191 #if INCLUDE_ALL_GCS
192 void G1NewTracer::send_g1_young_gc_event() {
193 EventG1GarbageCollection e(UNTIMED);
194 if (e.should_commit()) {
195 e.set_gcId(GCId::current());
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
203 void G1MMUTracer::send_g1_mmu_event(double time_slice_ms, double gc_time_ms, double max_time_ms) {
204 EventG1MMU e;
205 if (e.should_commit()) {
206 e.set_gcId(GCId::current());
207 e.set_timeSlice(time_slice_ms);
208 e.set_gcTime(gc_time_ms);
209 e.set_pauseTarget(max_time_ms);
210 e.commit();
211 }
294 size_t current_occupancy,
295 size_t additional_buffer_size,
296 double predicted_allocation_rate,
297 double predicted_marking_length,
298 bool prediction_active) {
299 EventG1AdaptiveIHOP evt;
300 if (evt.should_commit()) {
301 evt.set_gcId(GCId::current());
302 evt.set_threshold(threshold);
303 evt.set_thresholdPercentage(internal_target_occupancy > 0 ? ((double)threshold / internal_target_occupancy) : 0.0);
304 evt.set_ihopTargetOccupancy(internal_target_occupancy);
305 evt.set_currentOccupancy(current_occupancy);
306 evt.set_additionalBufferSize(additional_buffer_size);
307 evt.set_predictedAllocationRate(predicted_allocation_rate);
308 evt.set_predictedMarkingDuration(predicted_marking_length * MILLIUNITS);
309 evt.set_predictionActive(prediction_active);
310 evt.commit();
311 }
312 }
313
314 #endif
315
316 static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) {
317 TraceStructVirtualSpace space;
318 space.set_start((TraceAddress)summary.start());
319 space.set_committedEnd((TraceAddress)summary.committed_end());
320 space.set_committedSize(summary.committed_size());
321 space.set_reservedEnd((TraceAddress)summary.reserved_end());
322 space.set_reservedSize(summary.reserved_size());
323 return space;
324 }
325
326 static TraceStructObjectSpace to_trace_struct(const SpaceSummary& summary) {
327 TraceStructObjectSpace space;
328 space.set_start((TraceAddress)summary.start());
329 space.set_end((TraceAddress)summary.end());
330 space.set_used(summary.used());
331 space.set_size(summary.size());
332 return space;
333 }
334
|
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"
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 "tracefiles/traceEventClasses.hpp"
35 #include "utilities/macros.hpp"
36 #if INCLUDE_G1GC
37 #include "gc/g1/evacuationInfo.hpp"
38 #include "gc/g1/g1YCTypes.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 EventGarbageCollection 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
171
172 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
173 EventPromotionFailed e;
174 if (e.should_commit()) {
175 e.set_gcId(GCId::current());
176 e.set_promotionFailed(to_trace_struct(pf_info));
177 e.set_thread(pf_info.thread_trace_id());
178 e.commit();
179 }
180 }
181
182 // Common to CMS and G1
183 void OldGCTracer::send_concurrent_mode_failure_event() {
184 EventConcurrentModeFailure e;
185 if (e.should_commit()) {
186 e.set_gcId(GCId::current());
187 e.commit();
188 }
189 }
190
191 #if INCLUDE_G1GC
192 void G1NewTracer::send_g1_young_gc_event() {
193 EventG1GarbageCollection e(UNTIMED);
194 if (e.should_commit()) {
195 e.set_gcId(GCId::current());
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
203 void G1MMUTracer::send_g1_mmu_event(double time_slice_ms, double gc_time_ms, double max_time_ms) {
204 EventG1MMU e;
205 if (e.should_commit()) {
206 e.set_gcId(GCId::current());
207 e.set_timeSlice(time_slice_ms);
208 e.set_gcTime(gc_time_ms);
209 e.set_pauseTarget(max_time_ms);
210 e.commit();
211 }
294 size_t current_occupancy,
295 size_t additional_buffer_size,
296 double predicted_allocation_rate,
297 double predicted_marking_length,
298 bool prediction_active) {
299 EventG1AdaptiveIHOP evt;
300 if (evt.should_commit()) {
301 evt.set_gcId(GCId::current());
302 evt.set_threshold(threshold);
303 evt.set_thresholdPercentage(internal_target_occupancy > 0 ? ((double)threshold / internal_target_occupancy) : 0.0);
304 evt.set_ihopTargetOccupancy(internal_target_occupancy);
305 evt.set_currentOccupancy(current_occupancy);
306 evt.set_additionalBufferSize(additional_buffer_size);
307 evt.set_predictedAllocationRate(predicted_allocation_rate);
308 evt.set_predictedMarkingDuration(predicted_marking_length * MILLIUNITS);
309 evt.set_predictionActive(prediction_active);
310 evt.commit();
311 }
312 }
313
314 #endif // INCLUDE_G1GC
315
316 static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) {
317 TraceStructVirtualSpace space;
318 space.set_start((TraceAddress)summary.start());
319 space.set_committedEnd((TraceAddress)summary.committed_end());
320 space.set_committedSize(summary.committed_size());
321 space.set_reservedEnd((TraceAddress)summary.reserved_end());
322 space.set_reservedSize(summary.reserved_size());
323 return space;
324 }
325
326 static TraceStructObjectSpace to_trace_struct(const SpaceSummary& summary) {
327 TraceStructObjectSpace space;
328 space.set_start((TraceAddress)summary.start());
329 space.set_end((TraceAddress)summary.end());
330 space.set_used(summary.used());
331 space.set_size(summary.size());
332 return space;
333 }
334
|