src/hotspot/share/gc/g1/g1Analytics.cpp
changeset 59320 11ff4e485670
parent 59319 9ee940f1de90
equal deleted inserted replaced
59319:9ee940f1de90 59320:11ff4e485670
   123 
   123 
   124 bool G1Analytics::enough_samples_available(TruncatedSeq const* seq) const {
   124 bool G1Analytics::enough_samples_available(TruncatedSeq const* seq) const {
   125   return seq->num() >= 3;
   125   return seq->num() >= 3;
   126 }
   126 }
   127 
   127 
   128 double G1Analytics::get_new_prediction(TruncatedSeq const* seq) const {
   128 double G1Analytics::get_new_unit_prediction(TruncatedSeq const* seq) const {
   129   return _predictor->get_new_prediction(seq);
   129   return _predictor->get_new_unit_prediction(seq);
   130 }
   130 }
   131 
   131 
   132 size_t G1Analytics::get_new_size_prediction(TruncatedSeq const* seq) const {
   132 size_t G1Analytics::get_new_size_prediction(TruncatedSeq const* seq) const {
   133   return (size_t)get_new_prediction(seq);
   133   return (size_t)get_new_lower_zero_bound_prediction(seq);
       
   134 }
       
   135 
       
   136 double G1Analytics::get_new_lower_zero_bound_prediction(TruncatedSeq const* seq) const {
       
   137   return _predictor->get_new_lower_zero_bound_prediction(seq);
   134 }
   138 }
   135 
   139 
   136 int G1Analytics::num_alloc_rate_ms() const {
   140 int G1Analytics::num_alloc_rate_ms() const {
   137   return _alloc_rate_ms_seq->num();
   141   return _alloc_rate_ms_seq->num();
   138 }
   142 }
   223 void G1Analytics::report_rs_length(double rs_length) {
   227 void G1Analytics::report_rs_length(double rs_length) {
   224   _rs_length_seq->add(rs_length);
   228   _rs_length_seq->add(rs_length);
   225 }
   229 }
   226 
   230 
   227 double G1Analytics::predict_alloc_rate_ms() const {
   231 double G1Analytics::predict_alloc_rate_ms() const {
   228   return get_new_prediction(_alloc_rate_ms_seq);
   232   return get_new_lower_zero_bound_prediction(_alloc_rate_ms_seq);
   229 }
   233 }
   230 
   234 
   231 double G1Analytics::predict_concurrent_refine_rate_ms() const {
   235 double G1Analytics::predict_concurrent_refine_rate_ms() const {
   232   return get_new_prediction(_concurrent_refine_rate_ms_seq);
   236   return get_new_lower_zero_bound_prediction(_concurrent_refine_rate_ms_seq);
   233 }
   237 }
   234 
   238 
   235 double G1Analytics::predict_logged_cards_rate_ms() const {
   239 double G1Analytics::predict_logged_cards_rate_ms() const {
   236   return get_new_prediction(_logged_cards_rate_ms_seq);
   240   return get_new_lower_zero_bound_prediction(_logged_cards_rate_ms_seq);
   237 }
   241 }
   238 
   242 
   239 double G1Analytics::predict_young_card_merge_to_scan_ratio() const {
   243 double G1Analytics::predict_young_card_merge_to_scan_ratio() const {
   240   return get_new_prediction(_young_card_merge_to_scan_ratio_seq);
   244   return get_new_unit_prediction(_young_card_merge_to_scan_ratio_seq);
   241 }
   245 }
   242 
   246 
   243 size_t G1Analytics::predict_scan_card_num(size_t rs_length, bool for_young_gc) const {
   247 size_t G1Analytics::predict_scan_card_num(size_t rs_length, bool for_young_gc) const {
   244   if (for_young_gc || !enough_samples_available(_mixed_card_merge_to_scan_ratio_seq)) {
   248   if (for_young_gc || !enough_samples_available(_mixed_card_merge_to_scan_ratio_seq)) {
   245     return (size_t) (rs_length * predict_young_card_merge_to_scan_ratio());
   249     return (size_t)(rs_length * predict_young_card_merge_to_scan_ratio());
   246   } else {
   250   } else {
   247     return (size_t) (rs_length * get_new_prediction(_mixed_card_merge_to_scan_ratio_seq));
   251     return (size_t)(rs_length * get_new_unit_prediction(_mixed_card_merge_to_scan_ratio_seq));
   248   }
   252   }
   249 }
   253 }
   250 
   254 
   251 double G1Analytics::predict_card_merge_time_ms(size_t card_num, bool for_young_gc) const {
   255 double G1Analytics::predict_card_merge_time_ms(size_t card_num, bool for_young_gc) const {
   252   if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_merge_ms_seq)) {
   256   if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_merge_ms_seq)) {
   253     return card_num * get_new_prediction(_young_cost_per_card_merge_ms_seq);
   257     return card_num * get_new_lower_zero_bound_prediction(_young_cost_per_card_merge_ms_seq);
   254   } else {
   258   } else {
   255     return card_num * get_new_prediction(_mixed_cost_per_card_merge_ms_seq);
   259     return card_num * get_new_lower_zero_bound_prediction(_mixed_cost_per_card_merge_ms_seq);
   256   }
   260   }
   257 }
   261 }
   258 
   262 
   259 double G1Analytics::predict_card_scan_time_ms(size_t card_num, bool for_young_gc) const {
   263 double G1Analytics::predict_card_scan_time_ms(size_t card_num, bool for_young_gc) const {
   260   if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_scan_ms_seq)) {
   264   if (for_young_gc || !enough_samples_available(_mixed_cost_per_card_scan_ms_seq)) {
   261     return card_num * get_new_prediction(_young_cost_per_card_scan_ms_seq);
   265     return card_num * get_new_lower_zero_bound_prediction(_young_cost_per_card_scan_ms_seq);
   262   } else {
   266   } else {
   263     return card_num * get_new_prediction(_mixed_cost_per_card_scan_ms_seq);
   267     return card_num * get_new_lower_zero_bound_prediction(_mixed_cost_per_card_scan_ms_seq);
   264   }
   268   }
   265 }
   269 }
   266 
   270 
   267 double G1Analytics::predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const {
   271 double G1Analytics::predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) const {
   268   if (!enough_samples_available(_cost_per_byte_ms_during_cm_seq)) {
   272   if (!enough_samples_available(_cost_per_byte_ms_during_cm_seq)) {
   269     return (1.1 * bytes_to_copy) * get_new_prediction(_copy_cost_per_byte_ms_seq);
   273     return (1.1 * bytes_to_copy) * get_new_lower_zero_bound_prediction(_copy_cost_per_byte_ms_seq);
   270   } else {
   274   } else {
   271     return bytes_to_copy * get_new_prediction(_cost_per_byte_ms_during_cm_seq);
   275     return bytes_to_copy * get_new_lower_zero_bound_prediction(_cost_per_byte_ms_during_cm_seq);
   272   }
   276   }
   273 }
   277 }
   274 
   278 
   275 double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const {
   279 double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool during_concurrent_mark) const {
   276   if (during_concurrent_mark) {
   280   if (during_concurrent_mark) {
   277     return predict_object_copy_time_ms_during_cm(bytes_to_copy);
   281     return predict_object_copy_time_ms_during_cm(bytes_to_copy);
   278   } else {
   282   } else {
   279     return bytes_to_copy * get_new_prediction(_copy_cost_per_byte_ms_seq);
   283     return bytes_to_copy * get_new_lower_zero_bound_prediction(_copy_cost_per_byte_ms_seq);
   280   }
   284   }
   281 }
   285 }
   282 
   286 
   283 double G1Analytics::predict_constant_other_time_ms() const {
   287 double G1Analytics::predict_constant_other_time_ms() const {
   284   return get_new_prediction(_constant_other_time_ms_seq);
   288   return get_new_lower_zero_bound_prediction(_constant_other_time_ms_seq);
   285 }
   289 }
   286 
   290 
   287 double G1Analytics::predict_young_other_time_ms(size_t young_num) const {
   291 double G1Analytics::predict_young_other_time_ms(size_t young_num) const {
   288   return young_num * get_new_prediction(_young_other_cost_per_region_ms_seq);
   292   return young_num * get_new_lower_zero_bound_prediction(_young_other_cost_per_region_ms_seq);
   289 }
   293 }
   290 
   294 
   291 double G1Analytics::predict_non_young_other_time_ms(size_t non_young_num) const {
   295 double G1Analytics::predict_non_young_other_time_ms(size_t non_young_num) const {
   292   return non_young_num * get_new_prediction(_non_young_other_cost_per_region_ms_seq);
   296   return non_young_num * get_new_lower_zero_bound_prediction(_non_young_other_cost_per_region_ms_seq);
   293 }
   297 }
   294 
   298 
   295 double G1Analytics::predict_remark_time_ms() const {
   299 double G1Analytics::predict_remark_time_ms() const {
   296   return get_new_prediction(_concurrent_mark_remark_times_ms);
   300   return get_new_lower_zero_bound_prediction(_concurrent_mark_remark_times_ms);
   297 }
   301 }
   298 
   302 
   299 double G1Analytics::predict_cleanup_time_ms() const {
   303 double G1Analytics::predict_cleanup_time_ms() const {
   300   return get_new_prediction(_concurrent_mark_cleanup_times_ms);
   304   return get_new_lower_zero_bound_prediction(_concurrent_mark_cleanup_times_ms);
   301 }
   305 }
   302 
   306 
   303 size_t G1Analytics::predict_rs_length() const {
   307 size_t G1Analytics::predict_rs_length() const {
   304   return get_new_size_prediction(_rs_length_seq) + get_new_prediction(_rs_length_diff_seq);
   308   return get_new_size_prediction(_rs_length_seq) + get_new_size_prediction(_rs_length_diff_seq);
   305 }
   309 }
   306 
   310 
   307 size_t G1Analytics::predict_pending_cards() const {
   311 size_t G1Analytics::predict_pending_cards() const {
   308   return get_new_size_prediction(_pending_cards_seq);
   312   return get_new_size_prediction(_pending_cards_seq);
   309 }
   313 }