770 "min_young_length, the result of the binary search, should be "
771 "optimal, so no larger length should fit into the pause target");
772 }
773 } else {
774 // Even the minimum length doesn't fit into the pause time
775 // target, return it as the result nevertheless.
776 }
777 return base_min_length + min_young_length;
778 }
779
780 double G1CollectorPolicy::predict_survivor_regions_evac_time() const {
781 double survivor_regions_evac_time = 0.0;
782 for (HeapRegion * r = _recorded_survivor_head;
783 r != NULL && r != _recorded_survivor_tail->get_next_young_region();
784 r = r->get_next_young_region()) {
785 survivor_regions_evac_time += predict_region_elapsed_time_ms(r, collector_state()->gcs_are_young());
786 }
787 return survivor_regions_evac_time;
788 }
789
790 void G1CollectorPolicy::revise_young_list_target_length_if_necessary() {
791 guarantee( adaptive_young_list_length(), "should not call this otherwise" );
792
793 size_t rs_lengths = _g1->young_list()->sampled_rs_lengths();
794 if (rs_lengths > _rs_lengths_prediction) {
795 // add 10% to avoid having to recalculate often
796 size_t rs_lengths_prediction = rs_lengths * 1100 / 1000;
797 update_rs_lengths_prediction(rs_lengths_prediction);
798
799 update_young_list_max_and_target_length(rs_lengths_prediction);
800 }
801 }
802
803 void G1CollectorPolicy::update_rs_lengths_prediction() {
804 update_rs_lengths_prediction(get_new_size_prediction(_rs_lengths_seq));
805 }
806
807 void G1CollectorPolicy::update_rs_lengths_prediction(size_t prediction) {
808 if (collector_state()->gcs_are_young() && adaptive_young_list_length()) {
809 _rs_lengths_prediction = prediction;
810 }
811 }
812
813 #ifndef PRODUCT
|
770 "min_young_length, the result of the binary search, should be "
771 "optimal, so no larger length should fit into the pause target");
772 }
773 } else {
774 // Even the minimum length doesn't fit into the pause time
775 // target, return it as the result nevertheless.
776 }
777 return base_min_length + min_young_length;
778 }
779
780 double G1CollectorPolicy::predict_survivor_regions_evac_time() const {
781 double survivor_regions_evac_time = 0.0;
782 for (HeapRegion * r = _recorded_survivor_head;
783 r != NULL && r != _recorded_survivor_tail->get_next_young_region();
784 r = r->get_next_young_region()) {
785 survivor_regions_evac_time += predict_region_elapsed_time_ms(r, collector_state()->gcs_are_young());
786 }
787 return survivor_regions_evac_time;
788 }
789
790 void G1CollectorPolicy::revise_young_list_target_length_if_necessary(size_t rs_lengths) {
791 guarantee( adaptive_young_list_length(), "should not call this otherwise" );
792
793 if (rs_lengths > _rs_lengths_prediction) {
794 // add 10% to avoid having to recalculate often
795 size_t rs_lengths_prediction = rs_lengths * 1100 / 1000;
796 update_rs_lengths_prediction(rs_lengths_prediction);
797
798 update_young_list_max_and_target_length(rs_lengths_prediction);
799 }
800 }
801
802 void G1CollectorPolicy::update_rs_lengths_prediction() {
803 update_rs_lengths_prediction(get_new_size_prediction(_rs_lengths_seq));
804 }
805
806 void G1CollectorPolicy::update_rs_lengths_prediction(size_t prediction) {
807 if (collector_state()->gcs_are_young() && adaptive_young_list_length()) {
808 _rs_lengths_prediction = prediction;
809 }
810 }
811
812 #ifndef PRODUCT
|