--- old/src/share/vm/gc/g1/g1CollectorPolicy.cpp 2015-11-06 11:44:32.382593629 +0100 +++ new/src/share/vm/gc/g1/g1CollectorPolicy.cpp 2015-11-06 11:44:32.299591208 +0100 @@ -1232,6 +1232,8 @@ } _last_old_allocated_bytes = 0; + _ihop_control->send_jfr_event(_g1->gc_tracer_stw()); + // Note that _mmu_tracker->max_gc_time() returns the time in seconds. double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; --- old/src/share/vm/gc/g1/g1IHOPControl.cpp 2015-11-06 11:44:32.887608359 +0100 +++ new/src/share/vm/gc/g1/g1IHOPControl.cpp 2015-11-06 11:44:32.805605967 +0100 @@ -27,6 +27,7 @@ #include "gc/g1/g1ErgoVerbose.hpp" #include "gc/g1/g1IHOPControl.hpp" #include "gc/g1/g1Predictions.hpp" +#include "gc/shared/gcTrace.hpp" G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) : _ihop_percent(initial_ihop_percent), @@ -59,6 +60,15 @@ _last_marking_length_s * 1000.0); } +void G1StaticIHOPControl::send_jfr_event(G1NewTracer* tracer) { + tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(), + _target_occupancy, + G1CollectedHeap::heap()->used(), + _last_allocated_bytes, + _last_allocation_time_s, + _last_marking_length_s); +} + #ifndef PRODUCT static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amount, size_t young_size, double mark_time) { for (int i = 0; i < 100; i++) { @@ -184,6 +194,19 @@ ); } +void G1AdaptiveIHOPControl::send_jfr_event(G1NewTracer* tracer) { + tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(), + _target_occupancy, + G1CollectedHeap::heap()->used(), + _last_allocation_bytes, + _allocation_rate_s.last(), + _marking_times_s.last()); + tracer->report_adaptive_ihop_statistics(_prev_unrestrained_young_size, + _predictor->get_new_prediction(&_allocation_rate_s), + _predictor->get_new_prediction(&_marking_times_s), + have_enough_data_for_prediction()); +} + #ifndef PRODUCT void G1AdaptiveIHOPControl::test() { size_t const initial_threshold = 45; --- old/src/share/vm/gc/g1/g1IHOPControl.hpp 2015-11-06 11:44:33.357622068 +0100 +++ new/src/share/vm/gc/g1/g1IHOPControl.hpp 2015-11-06 11:44:33.274619647 +0100 @@ -29,6 +29,7 @@ #include "utilities/numberSeq.hpp" class G1Predictions; +class G1NewTracer; // Manages the decision about the threshold when concurrent marking should start. class G1IHOPControl : public CHeapObj { @@ -53,6 +54,7 @@ virtual void update_time_to_mixed(double marking_length_s) = 0; virtual void print() = 0; + virtual void send_jfr_event(G1NewTracer* tracer) = 0; }; class G1StaticIHOPControl : public G1IHOPControl { @@ -76,6 +78,7 @@ } virtual void print(); + virtual void send_jfr_event(G1NewTracer* tracer); #ifndef PRODUCT static void test(); #endif @@ -107,6 +110,7 @@ virtual void update_time_to_mixed(double marking_length_s); virtual void print(); + virtual void send_jfr_event(G1NewTracer* tracer); #ifndef PRODUCT static void test(); #endif --- old/src/share/vm/gc/shared/gcTrace.cpp 2015-11-06 11:44:33.821635602 +0100 +++ new/src/share/vm/gc/shared/gcTrace.cpp 2015-11-06 11:44:33.739633210 +0100 @@ -212,4 +212,28 @@ send_old_evacuation_statistics(old_summary); } +void G1NewTracer::report_basic_ihop_statistics(size_t threshold, + size_t target_ccupancy, + size_t current_occupancy, + size_t last_allocation_size, + double last_allocation_duration, + double last_marking_length) { + send_basic_ihop_statistics(threshold, + target_ccupancy, + current_occupancy, + last_allocation_size, + last_allocation_duration, + last_marking_length); +} + +void G1NewTracer::report_adaptive_ihop_statistics(size_t additional_buffer_size, + double predicted_allocation_rate, + double predicted_marking_length, + bool prediction_active) { + send_adaptive_ihop_statistics(additional_buffer_size, + predicted_allocation_rate, + predicted_marking_length, + prediction_active); +} + #endif --- old/src/share/vm/gc/shared/gcTrace.hpp 2015-11-06 11:44:34.283649078 +0100 +++ new/src/share/vm/gc/shared/gcTrace.hpp 2015-11-06 11:44:34.201646686 +0100 @@ -253,6 +253,17 @@ void report_evacuation_failed(EvacuationFailedInfo& ef_info); void report_evacuation_statistics(const G1EvacSummary& young_summary, const G1EvacSummary& old_summary) const; + + void report_basic_ihop_statistics(size_t threshold, + size_t target_occupancy, + size_t current_occupancy, + size_t last_allocation_size, + double last_allocation_duration, + double last_marking_length); + void report_adaptive_ihop_statistics(size_t additional_buffer_size, + double predicted_allocation_rate, + double predicted_marking_length, + bool prediction_active); private: void send_g1_young_gc_event(); void send_evacuation_info_event(EvacuationInfo* info); @@ -260,6 +271,17 @@ void send_young_evacuation_statistics(const G1EvacSummary& summary) const; void send_old_evacuation_statistics(const G1EvacSummary& summary) const; + + void send_basic_ihop_statistics(size_t threshold, + size_t target_occupancy, + size_t current_occupancy, + size_t last_allocation_size, + double last_allocation_duration, + double last_marking_length); + void send_adaptive_ihop_statistics(size_t additional_buffer_size, + double predicted_allocation_rate, + double predicted_marking_length, + bool prediction_active); }; #endif --- old/src/share/vm/gc/shared/gcTraceSend.cpp 2015-11-06 11:44:34.749662670 +0100 +++ new/src/share/vm/gc/shared/gcTraceSend.cpp 2015-11-06 11:44:34.667660279 +0100 @@ -35,6 +35,7 @@ #if INCLUDE_ALL_GCS #include "gc/g1/evacuationInfo.hpp" #include "gc/g1/g1YCTypes.hpp" +#include "tracefiles/traceEventClasses.hpp" #endif // All GC dependencies against the trace framework is contained within this file. @@ -265,6 +266,43 @@ old_evt.commit(); } } + +void G1NewTracer::send_basic_ihop_statistics(size_t threshold, + size_t target_occupancy, + size_t current_occupancy, + size_t last_allocation_ize, + double last_allocation_duration, + double last_marking_length) { + EventGCG1BasicIHOP evt; + if (evt.should_commit()) { + evt.set_gcId(GCId::current()); + evt.set_threshold(threshold); + evt.set_targetOccupancy(target_occupancy); + evt.set_thresholdPercentage(threshold * 100.0 / target_occupancy); + evt.set_currentOccupancy(current_occupancy); + evt.set_lastAllocationSize(last_allocation_ize); + evt.set_lastAllocationDuration(last_allocation_duration); + evt.set_lastAllocationRate(last_allocation_duration != 0.0 ? last_allocation_ize / last_allocation_duration : 0.0); + evt.set_lastMarkingLength(last_marking_length); + evt.commit(); + } +} + +void G1NewTracer::send_adaptive_ihop_statistics(size_t additional_buffer_size, + double predicted_allocation_rate, + double predicted_marking_length, + bool prediction_active) { + EventGCG1AdaptiveIHOP evt; + if (evt.should_commit()) { + evt.set_gcId(GCId::current()); + evt.set_additionalBufferSize(additional_buffer_size); + evt.set_predictedAllocationRate(predicted_allocation_rate); + evt.set_predictedMarkingLength(predicted_marking_length); + evt.set_predictionActive(prediction_active); + evt.commit(); + } +} + #endif static TraceStructVirtualSpace to_trace_struct(const VirtualSpaceSummary& summary) { --- old/src/share/vm/trace/trace.xml 2015-11-06 11:44:35.217676321 +0100 +++ new/src/share/vm/trace/trace.xml 2015-11-06 11:44:35.135673929 +0100 @@ -369,6 +369,28 @@ + + + + + + + + + + + + + + + + + + + +