src/hotspot/share/gc/g1/g1Policy.cpp
changeset 58797 f29ca6895893
parent 58508 d6058bd73982
child 58798 08e78887ff96
equal deleted inserted replaced
58796:7608c17b7463 58797:f29ca6895893
    66   _survivor_surv_rate_group(new SurvRateGroup()),
    66   _survivor_surv_rate_group(new SurvRateGroup()),
    67   _reserve_factor((double) G1ReservePercent / 100.0),
    67   _reserve_factor((double) G1ReservePercent / 100.0),
    68   _reserve_regions(0),
    68   _reserve_regions(0),
    69   _young_gen_sizer(G1YoungGenSizer::create_gen_sizer()),
    69   _young_gen_sizer(G1YoungGenSizer::create_gen_sizer()),
    70   _free_regions_at_end_of_collection(0),
    70   _free_regions_at_end_of_collection(0),
    71   _max_rs_length(0),
    71   _rs_length(0),
    72   _rs_length_prediction(0),
    72   _rs_length_prediction(0),
    73   _pending_cards_at_gc_start(0),
    73   _pending_cards_at_gc_start(0),
    74   _pending_cards_at_prev_gc_end(0),
    74   _pending_cards_at_prev_gc_end(0),
    75   _total_mutator_refined_cards(0),
    75   _total_mutator_refined_cards(0),
    76   _total_concurrent_refined_cards(0),
    76   _total_concurrent_refined_cards(0),
   751 
   751 
   752       cost_per_remset_card_ms = avg_time_remset_scan / remset_cards_scanned;
   752       cost_per_remset_card_ms = avg_time_remset_scan / remset_cards_scanned;
   753       _analytics->report_cost_per_remset_card_ms(cost_per_remset_card_ms, this_pause_was_young_only);
   753       _analytics->report_cost_per_remset_card_ms(cost_per_remset_card_ms, this_pause_was_young_only);
   754     }
   754     }
   755 
   755 
   756     if (_max_rs_length > 0) {
   756     if (_rs_length > 0) {
   757       double cards_per_entry_ratio =
   757       double cards_per_entry_ratio =
   758         (double) remset_cards_scanned / (double) _max_rs_length;
   758         (double) remset_cards_scanned / (double) _rs_length;
   759       _analytics->report_cards_per_entry_ratio(cards_per_entry_ratio, this_pause_was_young_only);
   759       _analytics->report_cards_per_entry_ratio(cards_per_entry_ratio, this_pause_was_young_only);
   760     }
   760     }
   761 
   761 
   762     // This is defensive. For a while _max_rs_length could get
   762     // This is defensive. For a while _rs_length could get
   763     // smaller than _recorded_rs_length which was causing
   763     // smaller than _recorded_rs_length which was causing
   764     // rs_length_diff to get very large and mess up the RSet length
   764     // rs_length_diff to get very large and mess up the RSet length
   765     // predictions. The reason was unsafe concurrent updates to the
   765     // predictions. The reason was unsafe concurrent updates to the
   766     // _inc_cset_recorded_rs_length field which the code below guards
   766     // _inc_cset_recorded_rs_length field which the code below guards
   767     // against (see CR 7118202). This bug has now been fixed (see CR
   767     // against (see CR 7118202). This bug has now been fixed (see CR
   772     // which might cause it to calculate the length incorrectly (if,
   772     // which might cause it to calculate the length incorrectly (if,
   773     // say, it's in mid-coarsening). So I'll leave in the defensive
   773     // say, it's in mid-coarsening). So I'll leave in the defensive
   774     // conditional below just in case.
   774     // conditional below just in case.
   775     size_t rs_length_diff = 0;
   775     size_t rs_length_diff = 0;
   776     size_t recorded_rs_length = _collection_set->recorded_rs_length();
   776     size_t recorded_rs_length = _collection_set->recorded_rs_length();
   777     if (_max_rs_length > recorded_rs_length) {
   777     if (_rs_length > recorded_rs_length) {
   778       rs_length_diff = _max_rs_length - recorded_rs_length;
   778       rs_length_diff = _rs_length - recorded_rs_length;
   779     }
   779     }
   780     _analytics->report_rs_length_diff((double) rs_length_diff);
   780     _analytics->report_rs_length_diff((double) rs_length_diff);
   781 
   781 
   782     size_t freed_bytes = heap_used_bytes_before_gc - cur_used_bytes;
   782     size_t freed_bytes = heap_used_bytes_before_gc - cur_used_bytes;
   783     size_t copied_bytes = _collection_set->bytes_used_before() - freed_bytes;
   783     size_t copied_bytes = _collection_set->bytes_used_before() - freed_bytes;
   804     // these are is wildly different to during young only gc and mess up young gen sizing right
   804     // these are is wildly different to during young only gc and mess up young gen sizing right
   805     // after the mixed gc phase.
   805     // after the mixed gc phase.
   806     // During mixed gc we do not use them for young gen sizing.
   806     // During mixed gc we do not use them for young gen sizing.
   807     if (this_pause_was_young_only) {
   807     if (this_pause_was_young_only) {
   808       _analytics->report_pending_cards((double) _pending_cards_at_gc_start);
   808       _analytics->report_pending_cards((double) _pending_cards_at_gc_start);
   809       _analytics->report_rs_length((double) _max_rs_length);
   809       _analytics->report_rs_length((double) _rs_length);
   810     }
   810     }
   811   }
   811   }
   812 
   812 
   813   assert(!(this_pause_included_initial_mark && collector_state()->mark_or_rebuild_in_progress()),
   813   assert(!(this_pause_included_initial_mark && collector_state()->mark_or_rebuild_in_progress()),
   814          "If the last pause has been an initial mark, we should not have been in the marking window");
   814          "If the last pause has been an initial mark, we should not have been in the marking window");