< prev index next >

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

Print this page




 796   record_survivor_regions(0, NULL, NULL);
 797 
 798   _free_regions_at_end_of_collection = _g1->num_free_regions();
 799   // Reset survivors SurvRateGroup.
 800   _survivor_surv_rate_group->reset();
 801   update_young_list_target_length();
 802   _collectionSetChooser->clear();
 803 }
 804 
 805 void G1CollectorPolicy::record_stop_world_start() {
 806   _stop_world_start = os::elapsedTime();
 807 }
 808 
 809 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
 810   // We only need to do this here as the policy will only be applied
 811   // to the GC we're about to start. so, no point is calculating this
 812   // every time we calculate / recalculate the target young length.
 813   update_survivors_policy();
 814 
 815   assert(_g1->used() == _g1->recalculate_used(),
 816          err_msg("sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT,
 817                  _g1->used(), _g1->recalculate_used()));
 818 
 819   double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
 820   _trace_young_gen_time_data.record_start_collection(s_w_t_ms);
 821   _stop_world_start = 0.0;
 822 
 823   record_heap_size_info_at_start(false /* full */);
 824 
 825   phase_times()->record_cur_collection_start_sec(start_time_sec);
 826   _pending_cards = _g1->pending_card_num();
 827 
 828   _collection_set_bytes_used_before = 0;
 829   _bytes_copied_during_gc = 0;
 830 
 831   collector_state()->set_last_gc_was_young(false);
 832 
 833   // do that for any other surv rate groups
 834   _short_lived_surv_rate_group->stop_adding_regions();
 835   _survivors_age_table.clear();
 836 
 837   assert( verify_young_ages(), "region age verification" );


1859 
1860   G1CollectedHeap* g1h = G1CollectedHeap::heap();
1861   const size_t region_num = g1h->num_regions();
1862   const size_t perc = (size_t) G1OldCSetRegionThresholdPercent;
1863   size_t result = region_num * perc / 100;
1864   // emulate ceiling
1865   if (100 * result < region_num * perc) {
1866     result += 1;
1867   }
1868   return (uint) result;
1869 }
1870 
1871 
1872 double G1CollectorPolicy::finalize_young_cset_part(double target_pause_time_ms) {
1873   double young_start_time_sec = os::elapsedTime();
1874 
1875   YoungList* young_list = _g1->young_list();
1876   finalize_incremental_cset_building();
1877 
1878   guarantee(target_pause_time_ms > 0.0,
1879             err_msg("target_pause_time_ms = %1.6lf should be positive",
1880                     target_pause_time_ms));
1881   guarantee(_collection_set == NULL, "Precondition");
1882 
1883   double base_time_ms = predict_base_elapsed_time_ms(_pending_cards);
1884   double time_remaining_ms = MAX2(target_pause_time_ms - base_time_ms, 0.0);
1885 
1886   ergo_verbose4(ErgoCSetConstruction | ErgoHigh,
1887                 "start choosing CSet",
1888                 ergo_format_size("_pending_cards")
1889                 ergo_format_ms("predicted base time")
1890                 ergo_format_ms("remaining time")
1891                 ergo_format_ms("target pause time"),
1892                 _pending_cards, base_time_ms, time_remaining_ms, target_pause_time_ms);
1893 
1894   collector_state()->set_last_gc_was_young(collector_state()->gcs_are_young());
1895 
1896   if (collector_state()->last_gc_was_young()) {
1897     _trace_young_gen_time_data.increment_young_collection_count();
1898   } else {
1899     _trace_young_gen_time_data.increment_mixed_collection_count();
1900   }




 796   record_survivor_regions(0, NULL, NULL);
 797 
 798   _free_regions_at_end_of_collection = _g1->num_free_regions();
 799   // Reset survivors SurvRateGroup.
 800   _survivor_surv_rate_group->reset();
 801   update_young_list_target_length();
 802   _collectionSetChooser->clear();
 803 }
 804 
 805 void G1CollectorPolicy::record_stop_world_start() {
 806   _stop_world_start = os::elapsedTime();
 807 }
 808 
 809 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) {
 810   // We only need to do this here as the policy will only be applied
 811   // to the GC we're about to start. so, no point is calculating this
 812   // every time we calculate / recalculate the target young length.
 813   update_survivors_policy();
 814 
 815   assert(_g1->used() == _g1->recalculate_used(),
 816          "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT,
 817          _g1->used(), _g1->recalculate_used());
 818 
 819   double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0;
 820   _trace_young_gen_time_data.record_start_collection(s_w_t_ms);
 821   _stop_world_start = 0.0;
 822 
 823   record_heap_size_info_at_start(false /* full */);
 824 
 825   phase_times()->record_cur_collection_start_sec(start_time_sec);
 826   _pending_cards = _g1->pending_card_num();
 827 
 828   _collection_set_bytes_used_before = 0;
 829   _bytes_copied_during_gc = 0;
 830 
 831   collector_state()->set_last_gc_was_young(false);
 832 
 833   // do that for any other surv rate groups
 834   _short_lived_surv_rate_group->stop_adding_regions();
 835   _survivors_age_table.clear();
 836 
 837   assert( verify_young_ages(), "region age verification" );


1859 
1860   G1CollectedHeap* g1h = G1CollectedHeap::heap();
1861   const size_t region_num = g1h->num_regions();
1862   const size_t perc = (size_t) G1OldCSetRegionThresholdPercent;
1863   size_t result = region_num * perc / 100;
1864   // emulate ceiling
1865   if (100 * result < region_num * perc) {
1866     result += 1;
1867   }
1868   return (uint) result;
1869 }
1870 
1871 
1872 double G1CollectorPolicy::finalize_young_cset_part(double target_pause_time_ms) {
1873   double young_start_time_sec = os::elapsedTime();
1874 
1875   YoungList* young_list = _g1->young_list();
1876   finalize_incremental_cset_building();
1877 
1878   guarantee(target_pause_time_ms > 0.0,
1879             "target_pause_time_ms = %1.6lf should be positive", target_pause_time_ms);

1880   guarantee(_collection_set == NULL, "Precondition");
1881 
1882   double base_time_ms = predict_base_elapsed_time_ms(_pending_cards);
1883   double time_remaining_ms = MAX2(target_pause_time_ms - base_time_ms, 0.0);
1884 
1885   ergo_verbose4(ErgoCSetConstruction | ErgoHigh,
1886                 "start choosing CSet",
1887                 ergo_format_size("_pending_cards")
1888                 ergo_format_ms("predicted base time")
1889                 ergo_format_ms("remaining time")
1890                 ergo_format_ms("target pause time"),
1891                 _pending_cards, base_time_ms, time_remaining_ms, target_pause_time_ms);
1892 
1893   collector_state()->set_last_gc_was_young(collector_state()->gcs_are_young());
1894 
1895   if (collector_state()->last_gc_was_young()) {
1896     _trace_young_gen_time_data.increment_young_collection_count();
1897   } else {
1898     _trace_young_gen_time_data.increment_mixed_collection_count();
1899   }


< prev index next >