< prev index next >

src/hotspot/share/gc/g1/g1Policy.cpp

Print this page
rev 56986 : imported patch 8233588-cleanup-survrategroup


 890   // marking, which makes any prediction useless. This increases the accuracy of the
 891   // prediction.
 892   if (this_gc_was_young_only && mutator_time_s > min_valid_time) {
 893     _ihop_control->update_allocation_info(mutator_time_s, mutator_alloc_bytes, young_gen_size);
 894     report = true;
 895   }
 896 
 897   if (report) {
 898     report_ihop_statistics();
 899   }
 900 }
 901 
 902 void G1Policy::report_ihop_statistics() {
 903   _ihop_control->print();
 904 }
 905 
 906 void G1Policy::print_phases() {
 907   phase_times()->print();
 908 }
 909 
 910 double G1Policy::predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) const {
 911   TruncatedSeq* seq = surv_rate_group->get_seq(age);
 912   guarantee(seq->num() > 0, "There should be some young gen survivor samples available. Tried to access with age %d", age);
 913   return _predictor.get_new_unit_prediction(seq);
 914 }
 915 
 916 double G1Policy::accum_yg_surv_rate_pred(int age) const {
 917   return _short_lived_surv_rate_group->accum_surv_rate_pred(age);
 918 }
 919 
 920 double G1Policy::predict_base_elapsed_time_ms(size_t pending_cards,
 921                                               size_t rs_length) const {
 922   size_t effective_scanned_cards = _analytics->predict_scan_card_num(rs_length, collector_state()->in_young_only_phase());
 923   return
 924     _analytics->predict_card_merge_time_ms(pending_cards + rs_length, collector_state()->in_young_only_phase()) +
 925     _analytics->predict_card_scan_time_ms(effective_scanned_cards, collector_state()->in_young_only_phase()) +
 926     _analytics->predict_constant_other_time_ms();
 927 }
 928 
 929 double G1Policy::predict_base_elapsed_time_ms(size_t pending_cards) const {
 930   size_t rs_length = _analytics->predict_rs_length();
 931   return predict_base_elapsed_time_ms(pending_cards, rs_length);
 932 }
 933 
 934 size_t G1Policy::predict_bytes_to_copy(HeapRegion* hr) const {
 935   size_t bytes_to_copy;
 936   if (!hr->is_young()) {
 937     bytes_to_copy = hr->max_live_bytes();
 938   } else {
 939     assert(hr->age_in_surv_rate_group() != -1, "invariant");
 940     int age = hr->age_in_surv_rate_group();
 941     double yg_surv_rate = predict_yg_surv_rate(age, hr->surv_rate_group());
 942     bytes_to_copy = (size_t) (hr->used() * yg_surv_rate);
 943   }
 944   return bytes_to_copy;
 945 }
 946 
 947 double G1Policy::predict_region_elapsed_time_ms(HeapRegion* hr,
 948                                                 bool for_young_gc) const {
 949   size_t rs_length = hr->rem_set()->occupied();
 950   size_t scan_card_num = _analytics->predict_scan_card_num(rs_length, for_young_gc);
 951 
 952   size_t bytes_to_copy = predict_bytes_to_copy(hr);
 953 
 954   double region_elapsed_time_ms =
 955     _analytics->predict_card_merge_time_ms(rs_length, collector_state()->in_young_only_phase()) +
 956     _analytics->predict_card_scan_time_ms(scan_card_num, collector_state()->in_young_only_phase()) +
 957     _analytics->predict_object_copy_time_ms(bytes_to_copy, collector_state()->mark_or_rebuild_in_progress());
 958 
 959   // The prediction of the "other" time for this region is based
 960   // upon the region type and NOT the GC type.
 961   if (hr->is_young()) {
 962     region_elapsed_time_ms += _analytics->predict_young_other_time_ms(1);


1378     if (prediction_ms > time_remaining_ms) {
1379       log_debug(gc, ergo, cset)("Prediction %.3fms for region %u does not fit remaining time: %.3fms.",
1380                                 prediction_ms, r->hrm_index(), time_remaining_ms);
1381       break;
1382     }
1383     // This region will be included in the next optional evacuation.
1384 
1385     time_remaining_ms -= prediction_ms;
1386     num_optional_regions++;
1387     r = candidates->at(++candidate_idx);
1388   }
1389 
1390   log_debug(gc, ergo, cset)("Prepared %u regions out of %u for optional evacuation. Predicted time: %.3fms",
1391                             num_optional_regions, max_optional_regions, prediction_ms);
1392 }
1393 
1394 void G1Policy::transfer_survivors_to_cset(const G1SurvivorRegions* survivors) {
1395 
1396   // Add survivor regions to SurvRateGroup.
1397   note_start_adding_survivor_regions();
1398   finished_recalculating_age_indexes(true /* is_survivors */);
1399 
1400   HeapRegion* last = NULL;
1401   for (GrowableArrayIterator<HeapRegion*> it = survivors->regions()->begin();
1402        it != survivors->regions()->end();
1403        ++it) {
1404     HeapRegion* curr = *it;
1405     set_region_survivor(curr);
1406 
1407     // The region is a non-empty survivor so let's add it to
1408     // the incremental collection set for the next evacuation
1409     // pause.
1410     _collection_set->add_survivor_regions(curr);
1411 
1412     last = curr;
1413   }
1414   note_stop_adding_survivor_regions();
1415 
1416   // Don't clear the survivor list handles until the start of
1417   // the next evacuation pause - we need it in order to re-tag
1418   // the survivor regions from this evacuation pause as 'young'
1419   // at the start of the next.
1420 
1421   finished_recalculating_age_indexes(false /* is_survivors */);
1422 }


 890   // marking, which makes any prediction useless. This increases the accuracy of the
 891   // prediction.
 892   if (this_gc_was_young_only && mutator_time_s > min_valid_time) {
 893     _ihop_control->update_allocation_info(mutator_time_s, mutator_alloc_bytes, young_gen_size);
 894     report = true;
 895   }
 896 
 897   if (report) {
 898     report_ihop_statistics();
 899   }
 900 }
 901 
 902 void G1Policy::report_ihop_statistics() {
 903   _ihop_control->print();
 904 }
 905 
 906 void G1Policy::print_phases() {
 907   phase_times()->print();
 908 }
 909 






 910 double G1Policy::accum_yg_surv_rate_pred(int age) const {
 911   return _short_lived_surv_rate_group->accum_surv_rate_pred(age);
 912 }
 913 
 914 double G1Policy::predict_base_elapsed_time_ms(size_t pending_cards,
 915                                               size_t rs_length) const {
 916   size_t effective_scanned_cards = _analytics->predict_scan_card_num(rs_length, collector_state()->in_young_only_phase());
 917   return
 918     _analytics->predict_card_merge_time_ms(pending_cards + rs_length, collector_state()->in_young_only_phase()) +
 919     _analytics->predict_card_scan_time_ms(effective_scanned_cards, collector_state()->in_young_only_phase()) +
 920     _analytics->predict_constant_other_time_ms();
 921 }
 922 
 923 double G1Policy::predict_base_elapsed_time_ms(size_t pending_cards) const {
 924   size_t rs_length = _analytics->predict_rs_length();
 925   return predict_base_elapsed_time_ms(pending_cards, rs_length);
 926 }
 927 
 928 size_t G1Policy::predict_bytes_to_copy(HeapRegion* hr) const {
 929   size_t bytes_to_copy;
 930   if (!hr->is_young()) {
 931     bytes_to_copy = hr->max_live_bytes();
 932   } else {
 933     bytes_to_copy = (size_t) (hr->used() * hr->surv_rate_prediction(_predictor));



 934   }
 935   return bytes_to_copy;
 936 }
 937 
 938 double G1Policy::predict_region_elapsed_time_ms(HeapRegion* hr,
 939                                                 bool for_young_gc) const {
 940   size_t rs_length = hr->rem_set()->occupied();
 941   size_t scan_card_num = _analytics->predict_scan_card_num(rs_length, for_young_gc);
 942 
 943   size_t bytes_to_copy = predict_bytes_to_copy(hr);
 944 
 945   double region_elapsed_time_ms =
 946     _analytics->predict_card_merge_time_ms(rs_length, collector_state()->in_young_only_phase()) +
 947     _analytics->predict_card_scan_time_ms(scan_card_num, collector_state()->in_young_only_phase()) +
 948     _analytics->predict_object_copy_time_ms(bytes_to_copy, collector_state()->mark_or_rebuild_in_progress());
 949 
 950   // The prediction of the "other" time for this region is based
 951   // upon the region type and NOT the GC type.
 952   if (hr->is_young()) {
 953     region_elapsed_time_ms += _analytics->predict_young_other_time_ms(1);


1369     if (prediction_ms > time_remaining_ms) {
1370       log_debug(gc, ergo, cset)("Prediction %.3fms for region %u does not fit remaining time: %.3fms.",
1371                                 prediction_ms, r->hrm_index(), time_remaining_ms);
1372       break;
1373     }
1374     // This region will be included in the next optional evacuation.
1375 
1376     time_remaining_ms -= prediction_ms;
1377     num_optional_regions++;
1378     r = candidates->at(++candidate_idx);
1379   }
1380 
1381   log_debug(gc, ergo, cset)("Prepared %u regions out of %u for optional evacuation. Predicted time: %.3fms",
1382                             num_optional_regions, max_optional_regions, prediction_ms);
1383 }
1384 
1385 void G1Policy::transfer_survivors_to_cset(const G1SurvivorRegions* survivors) {
1386 
1387   // Add survivor regions to SurvRateGroup.
1388   note_start_adding_survivor_regions();

1389 
1390   HeapRegion* last = NULL;
1391   for (GrowableArrayIterator<HeapRegion*> it = survivors->regions()->begin();
1392        it != survivors->regions()->end();
1393        ++it) {
1394     HeapRegion* curr = *it;
1395     set_region_survivor(curr);
1396 
1397     // The region is a non-empty survivor so let's add it to
1398     // the incremental collection set for the next evacuation
1399     // pause.
1400     _collection_set->add_survivor_regions(curr);
1401 
1402     last = curr;
1403   }
1404   note_stop_adding_survivor_regions();
1405 
1406   // Don't clear the survivor list handles until the start of
1407   // the next evacuation pause - we need it in order to re-tag
1408   // the survivor regions from this evacuation pause as 'young'
1409   // at the start of the next.


1410 }
< prev index next >