< prev index next >

src/share/vm/gc/g1/g1DefaultPolicy.cpp

Print this page
rev 11552 : imported patch 8159978-collection-set-as-array


 377 
 378   if (rs_lengths > _rs_lengths_prediction) {
 379     // add 10% to avoid having to recalculate often
 380     size_t rs_lengths_prediction = rs_lengths * 1100 / 1000;
 381     update_rs_lengths_prediction(rs_lengths_prediction);
 382 
 383     update_young_list_max_and_target_length(rs_lengths_prediction);
 384   }
 385 }
 386 
 387 void G1DefaultPolicy::update_rs_lengths_prediction() {
 388   update_rs_lengths_prediction(_analytics->predict_rs_lengths());
 389 }
 390 
 391 void G1DefaultPolicy::update_rs_lengths_prediction(size_t prediction) {
 392   if (collector_state()->gcs_are_young() && adaptive_young_list_length()) {
 393     _rs_lengths_prediction = prediction;
 394   }
 395 }
 396 
 397 #ifndef PRODUCT
 398 bool G1DefaultPolicy::verify_young_ages() {
 399   bool ret = true;
 400 
 401   for (HeapRegion* curr = _collection_set->inc_head();
 402        curr != NULL;
 403        curr = curr->next_in_collection_set()) {
 404     guarantee(curr->is_young(), "Region must be young");
 405 
 406     SurvRateGroup* group = curr->surv_rate_group();
 407 
 408     if (group == NULL) {
 409       log_error(gc, verify)("## encountered NULL surv_rate_group in young region");
 410       ret = false;
 411     }
 412 
 413     if (curr->age_in_surv_rate_group() < 0) {
 414       log_error(gc, verify)("## encountered negative age in young region");
 415       ret = false;
 416     }
 417   }
 418 
 419   if (!ret) {
 420     LogStreamHandle(Error, gc, verify) log;
 421     _collection_set->print(_collection_set->inc_head(), &log);
 422   }
 423 
 424   return ret;
 425 }
 426 #endif // PRODUCT
 427 
 428 void G1DefaultPolicy::record_full_collection_start() {
 429   _full_collection_start_sec = os::elapsedTime();
 430   // Release the future to-space so that it is available for compaction into.
 431   collector_state()->set_full_collection(true);
 432 }
 433 
 434 void G1DefaultPolicy::record_full_collection_end() {
 435   // Consider this like a collection pause for the purposes of allocation
 436   // since last pause.
 437   double end_sec = os::elapsedTime();
 438   double full_gc_time_sec = end_sec - _full_collection_start_sec;
 439   double full_gc_time_ms = full_gc_time_sec * 1000.0;
 440 
 441   _analytics->update_recent_gc_times(end_sec, full_gc_time_ms);
 442 
 443   collector_state()->set_full_collection(false);
 444 
 445   // "Nuke" the heuristics that control the young/mixed GC
 446   // transitions and make sure we start with young GCs after the Full GC.
 447   collector_state()->set_gcs_are_young(true);


 471   // to the GC we're about to start. so, no point is calculating this
 472   // every time we calculate / recalculate the target young length.
 473   update_survivors_policy();
 474 
 475   assert(_g1->used() == _g1->recalculate_used(),
 476          "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT,
 477          _g1->used(), _g1->recalculate_used());
 478 
 479   phase_times()->record_cur_collection_start_sec(start_time_sec);
 480   _pending_cards = _g1->pending_card_num();
 481 
 482   _collection_set->reset_bytes_used_before();
 483   _bytes_copied_during_gc = 0;
 484 
 485   collector_state()->set_last_gc_was_young(false);
 486 
 487   // do that for any other surv rate groups
 488   _short_lived_surv_rate_group->stop_adding_regions();
 489   _survivors_age_table.clear();
 490 
 491   assert( verify_young_ages(), "region age verification" );
 492 }
 493 
 494 void G1DefaultPolicy::record_concurrent_mark_init_end(double mark_init_elapsed_time_ms) {
 495   collector_state()->set_during_marking(true);
 496   assert(!collector_state()->initiate_conc_mark_if_possible(), "we should have cleared it by now");
 497   collector_state()->set_during_initial_mark_pause(false);
 498 }
 499 
 500 void G1DefaultPolicy::record_concurrent_mark_remark_start() {
 501   _mark_remark_start_sec = os::elapsedTime();
 502   collector_state()->set_during_marking(false);
 503 }
 504 
 505 void G1DefaultPolicy::record_concurrent_mark_remark_end() {
 506   double end_time_sec = os::elapsedTime();
 507   double elapsed_time_ms = (end_time_sec - _mark_remark_start_sec)*1000.0;
 508   _analytics->report_concurrent_mark_remark_times_ms(elapsed_time_ms);
 509   _analytics->append_prev_collection_pause_end_ms(elapsed_time_ms);
 510 
 511   record_pause(Remark, _mark_remark_start_sec, end_time_sec);




 377 
 378   if (rs_lengths > _rs_lengths_prediction) {
 379     // add 10% to avoid having to recalculate often
 380     size_t rs_lengths_prediction = rs_lengths * 1100 / 1000;
 381     update_rs_lengths_prediction(rs_lengths_prediction);
 382 
 383     update_young_list_max_and_target_length(rs_lengths_prediction);
 384   }
 385 }
 386 
 387 void G1DefaultPolicy::update_rs_lengths_prediction() {
 388   update_rs_lengths_prediction(_analytics->predict_rs_lengths());
 389 }
 390 
 391 void G1DefaultPolicy::update_rs_lengths_prediction(size_t prediction) {
 392   if (collector_state()->gcs_are_young() && adaptive_young_list_length()) {
 393     _rs_lengths_prediction = prediction;
 394   }
 395 }
 396 































 397 void G1DefaultPolicy::record_full_collection_start() {
 398   _full_collection_start_sec = os::elapsedTime();
 399   // Release the future to-space so that it is available for compaction into.
 400   collector_state()->set_full_collection(true);
 401 }
 402 
 403 void G1DefaultPolicy::record_full_collection_end() {
 404   // Consider this like a collection pause for the purposes of allocation
 405   // since last pause.
 406   double end_sec = os::elapsedTime();
 407   double full_gc_time_sec = end_sec - _full_collection_start_sec;
 408   double full_gc_time_ms = full_gc_time_sec * 1000.0;
 409 
 410   _analytics->update_recent_gc_times(end_sec, full_gc_time_ms);
 411 
 412   collector_state()->set_full_collection(false);
 413 
 414   // "Nuke" the heuristics that control the young/mixed GC
 415   // transitions and make sure we start with young GCs after the Full GC.
 416   collector_state()->set_gcs_are_young(true);


 440   // to the GC we're about to start. so, no point is calculating this
 441   // every time we calculate / recalculate the target young length.
 442   update_survivors_policy();
 443 
 444   assert(_g1->used() == _g1->recalculate_used(),
 445          "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT,
 446          _g1->used(), _g1->recalculate_used());
 447 
 448   phase_times()->record_cur_collection_start_sec(start_time_sec);
 449   _pending_cards = _g1->pending_card_num();
 450 
 451   _collection_set->reset_bytes_used_before();
 452   _bytes_copied_during_gc = 0;
 453 
 454   collector_state()->set_last_gc_was_young(false);
 455 
 456   // do that for any other surv rate groups
 457   _short_lived_surv_rate_group->stop_adding_regions();
 458   _survivors_age_table.clear();
 459 
 460   assert(_g1->collection_set()->verify_young_ages(), "region age verification failed");
 461 }
 462 
 463 void G1DefaultPolicy::record_concurrent_mark_init_end(double mark_init_elapsed_time_ms) {
 464   collector_state()->set_during_marking(true);
 465   assert(!collector_state()->initiate_conc_mark_if_possible(), "we should have cleared it by now");
 466   collector_state()->set_during_initial_mark_pause(false);
 467 }
 468 
 469 void G1DefaultPolicy::record_concurrent_mark_remark_start() {
 470   _mark_remark_start_sec = os::elapsedTime();
 471   collector_state()->set_during_marking(false);
 472 }
 473 
 474 void G1DefaultPolicy::record_concurrent_mark_remark_end() {
 475   double end_time_sec = os::elapsedTime();
 476   double elapsed_time_ms = (end_time_sec - _mark_remark_start_sec)*1000.0;
 477   _analytics->report_concurrent_mark_remark_times_ms(elapsed_time_ms);
 478   _analytics->append_prev_collection_pause_end_ms(elapsed_time_ms);
 479 
 480   record_pause(Remark, _mark_remark_start_sec, end_time_sec);


< prev index next >