@@ -194,8 +194,9 @@ uint G1Policy::calculate_desired_eden_length_by_mmu() const {
194194}
195195
196196void G1Policy::update_young_length_bounds () {
197- update_young_length_bounds (_analytics->predict_pending_cards (),
198- _analytics->predict_rs_length ());
197+ bool for_young_gc = collector_state ()->in_young_only_phase ();
198+ update_young_length_bounds (_analytics->predict_pending_cards (for_young_gc),
199+ _analytics->predict_rs_length (for_young_gc));
199200}
200201
201202void G1Policy::update_young_length_bounds (size_t pending_cards, size_t rs_length) {
@@ -525,14 +526,15 @@ void G1Policy::revise_young_list_target_length_if_necessary(size_t rs_length) {
525526 update_rs_length_prediction (rs_length_prediction);
526527
527528 G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set ();
528- // We have no measure of the number of cards in the thread log buffers, assume
529- // these are very few compared to the sum of the two other sources .
529+ // We have no measure of the number of cards in the thread buffers, assume
530+ // these are very few compared to the ones in the DCQS .
530531 update_young_length_bounds (dcqs.num_cards (), rs_length_prediction);
531532 }
532533}
533534
534535void G1Policy::update_rs_length_prediction () {
535- update_rs_length_prediction (_analytics->predict_rs_length ());
536+ bool for_young_gc = collector_state ()->in_young_only_phase ();
537+ update_rs_length_prediction (_analytics->predict_rs_length (for_young_gc));
536538}
537539
538540void G1Policy::update_rs_length_prediction (size_t prediction) {
@@ -753,6 +755,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
753755 double pause_time_ms = (end_time_sec - start_time_sec) * 1000.0 ;
754756
755757 G1GCPauseType this_pause = collector_state ()->young_gc_pause_type (concurrent_operation_is_full_mark);
758+ bool is_young_only_pause = G1GCPauseTypeHelper::is_young_only_pause (this_pause);
756759
757760 if (G1GCPauseTypeHelper::is_concurrent_start_pause (this_pause)) {
758761 record_concurrent_mark_init_end ();
@@ -806,7 +809,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
806809 maybe_start_marking ();
807810 }
808811 } else {
809- assert (G1GCPauseTypeHelper:: is_young_only_pause(this_pause) , " must be" );
812+ assert (is_young_only_pause, " must be" );
810813 }
811814
812815 _eden_surv_rate_group->start_adding_regions ();
@@ -830,8 +833,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
830833 average_time_ms (G1GCPhaseTimes::MergeHCC) +
831834 average_time_ms (G1GCPhaseTimes::MergeLB) +
832835 average_time_ms (G1GCPhaseTimes::OptMergeRS);
833- _analytics->report_cost_per_card_merge_ms (avg_time_merge_cards / total_cards_merged,
834- G1GCPauseTypeHelper::is_young_only_pause (this_pause));
836+ _analytics->report_cost_per_card_merge_ms (avg_time_merge_cards / total_cards_merged, is_young_only_pause);
835837 }
836838
837839 // Update prediction for card scan
@@ -842,8 +844,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
842844 double avg_time_dirty_card_scan = average_time_ms (G1GCPhaseTimes::ScanHR) +
843845 average_time_ms (G1GCPhaseTimes::OptScanHR);
844846
845- _analytics->report_cost_per_card_scan_ms (avg_time_dirty_card_scan / total_cards_scanned,
846- G1GCPauseTypeHelper::is_young_only_pause (this_pause));
847+ _analytics->report_cost_per_card_scan_ms (avg_time_dirty_card_scan / total_cards_scanned, is_young_only_pause);
847848 }
848849
849850 // Update prediction for the ratio between cards from the remembered
@@ -857,12 +858,11 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
857858 if (total_cards_scanned > 0 ) {
858859 merge_to_scan_ratio = (double ) from_rs_length_cards / total_cards_scanned;
859860 }
860- _analytics->report_card_merge_to_scan_ratio (merge_to_scan_ratio,
861- G1GCPauseTypeHelper::is_young_only_pause (this_pause));
861+ _analytics->report_card_merge_to_scan_ratio (merge_to_scan_ratio, is_young_only_pause);
862862
863863 const size_t recorded_rs_length = _collection_set->recorded_rs_length ();
864864 const size_t rs_length_diff = _rs_length > recorded_rs_length ? _rs_length - recorded_rs_length : 0 ;
865- _analytics->report_rs_length_diff (rs_length_diff);
865+ _analytics->report_rs_length_diff (rs_length_diff, is_young_only_pause );
866866
867867 // Update prediction for copy cost per byte
868868 size_t copied_bytes = p->sum_thread_work_items (G1GCPhaseTimes::MergePSS, G1GCPhaseTimes::MergePSSCopiedBytes);
@@ -887,11 +887,8 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
887887 // Do not update RS lengths and the number of pending cards with information from mixed gc:
888888 // these are is wildly different to during young only gc and mess up young gen sizing right
889889 // after the mixed gc phase.
890- // During mixed gc we do not use them for young gen sizing.
891- if (G1GCPauseTypeHelper::is_young_only_pause (this_pause)) {
892- _analytics->report_pending_cards ((double ) _pending_cards_at_gc_start);
893- _analytics->report_rs_length ((double ) _rs_length);
894- }
890+ _analytics->report_pending_cards ((double ) _pending_cards_at_gc_start, is_young_only_pause);
891+ _analytics->report_rs_length ((double ) _rs_length, is_young_only_pause);
895892 }
896893
897894 assert (!(G1GCPauseTypeHelper::is_concurrent_start_pause (this_pause) && collector_state ()->mark_or_rebuild_in_progress ()),
@@ -1036,7 +1033,8 @@ double G1Policy::predict_base_time_ms(size_t pending_cards,
10361033}
10371034
10381035double G1Policy::predict_base_time_ms (size_t pending_cards) const {
1039- size_t rs_length = _analytics->predict_rs_length ();
1036+ bool for_young_gc = collector_state ()->in_young_only_phase ();
1037+ size_t rs_length = _analytics->predict_rs_length (for_young_gc);
10401038 return predict_base_time_ms (pending_cards, rs_length);
10411039}
10421040
0 commit comments