< prev index next >

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

Print this page
rev 56990 : imported patch 8228609-used-vs-copied-bytes
rev 56991 : imported patch 8228609-kbarrett-review
rev 56992 : imported patch 8227739-merge-scan-rs-update-rs-cost
rev 56993 : [mq]: 8227739-sjohanss-review


 705     if (!next_gc_should_be_mixed("continue mixed GCs",
 706                                  "do not continue mixed GCs")) {
 707       collector_state()->set_in_young_only_phase(true);
 708 
 709       clear_collection_set_candidates();
 710       maybe_start_marking();
 711     }
 712   }
 713 
 714   _short_lived_surv_rate_group->start_adding_regions();
 715 
 716   double merge_hcc_time_ms = average_time_ms(G1GCPhaseTimes::MergeHCC);
 717   if (update_stats) {
 718     size_t const total_log_buffer_cards = p->sum_thread_work_items(G1GCPhaseTimes::MergeHCC, G1GCPhaseTimes::MergeHCCDirtyCards) +
 719                                           p->sum_thread_work_items(G1GCPhaseTimes::MergeLB, G1GCPhaseTimes::MergeLBDirtyCards);
 720     // Update prediction for card merge; MergeRSDirtyCards includes the cards from the Eager Reclaim phase.
 721     size_t const total_cards_merged = p->sum_thread_work_items(G1GCPhaseTimes::MergeRS, G1GCPhaseTimes::MergeRSDirtyCards) +
 722                                       p->sum_thread_work_items(G1GCPhaseTimes::OptMergeRS, G1GCPhaseTimes::MergeRSDirtyCards) +
 723                                       total_log_buffer_cards;
 724 
 725     if (total_cards_merged > 10) {




 726       double avg_time_merge_cards = average_time_ms(G1GCPhaseTimes::MergeER) +
 727                                     average_time_ms(G1GCPhaseTimes::MergeRS) +
 728                                     average_time_ms(G1GCPhaseTimes::MergeHCC) +
 729                                     average_time_ms(G1GCPhaseTimes::MergeLB) +
 730                                     average_time_ms(G1GCPhaseTimes::OptMergeRS);
 731       _analytics->report_cost_per_card_merge_ms(avg_time_merge_cards / total_cards_merged, this_pause_was_young_only);
 732     }
 733 
 734     // Update prediction for card scan
 735     size_t const total_cards_scanned = p->sum_thread_work_items(G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::ScanHRScannedCards) +
 736                                        p->sum_thread_work_items(G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::ScanHRScannedCards);
 737 
 738     if (total_cards_scanned > 10) {
 739       double avg_time_dirty_card_scan = average_time_ms(G1GCPhaseTimes::ScanHR) +
 740                                         average_time_ms(G1GCPhaseTimes::OptScanHR);
 741 
 742       _analytics->report_cost_per_card_scan_ms(avg_time_dirty_card_scan / total_cards_scanned, this_pause_was_young_only);
 743     }
 744 
 745     // Update prediction for the ratio between cards from the remembered
 746     // sets and actually scanned cards from the remembered sets.
 747     // Cards from the remembered sets are all cards not duplicated by cards from
 748     // the logs.
 749     // Due to duplicates in the log buffers, the number of actually scanned cards
 750     // can be smaller than the cards in the log buffers.
 751     const size_t from_rs_length_cards = (total_cards_scanned > total_log_buffer_cards) ? total_cards_scanned - total_log_buffer_cards : 0;
 752     double merge_to_scan_ratio = 0.0;
 753     if (total_cards_scanned > 0) {
 754       merge_to_scan_ratio = (double) from_rs_length_cards / total_cards_scanned;
 755     }
 756    _analytics->report_card_merge_to_scan_ratio(merge_to_scan_ratio, this_pause_was_young_only);       
 757 
 758     const size_t recorded_rs_length = _collection_set->recorded_rs_length();




 705     if (!next_gc_should_be_mixed("continue mixed GCs",
 706                                  "do not continue mixed GCs")) {
 707       collector_state()->set_in_young_only_phase(true);
 708 
 709       clear_collection_set_candidates();
 710       maybe_start_marking();
 711     }
 712   }
 713 
 714   _short_lived_surv_rate_group->start_adding_regions();
 715 
 716   double merge_hcc_time_ms = average_time_ms(G1GCPhaseTimes::MergeHCC);
 717   if (update_stats) {
 718     size_t const total_log_buffer_cards = p->sum_thread_work_items(G1GCPhaseTimes::MergeHCC, G1GCPhaseTimes::MergeHCCDirtyCards) +
 719                                           p->sum_thread_work_items(G1GCPhaseTimes::MergeLB, G1GCPhaseTimes::MergeLBDirtyCards);
 720     // Update prediction for card merge; MergeRSDirtyCards includes the cards from the Eager Reclaim phase.
 721     size_t const total_cards_merged = p->sum_thread_work_items(G1GCPhaseTimes::MergeRS, G1GCPhaseTimes::MergeRSDirtyCards) +
 722                                       p->sum_thread_work_items(G1GCPhaseTimes::OptMergeRS, G1GCPhaseTimes::MergeRSDirtyCards) +
 723                                       total_log_buffer_cards;
 724 
 725     // The threshold for the number of cards in a given sampling which we consider
 726     // large enough so that the impact from setup and other costs is negligible.
 727     size_t const CardsNumSamplingThreshold = 10;
 728     
 729     if (total_cards_merged > CardsNumSamplingThreshold) {
 730       double avg_time_merge_cards = average_time_ms(G1GCPhaseTimes::MergeER) +
 731                                     average_time_ms(G1GCPhaseTimes::MergeRS) +
 732                                     average_time_ms(G1GCPhaseTimes::MergeHCC) +
 733                                     average_time_ms(G1GCPhaseTimes::MergeLB) +
 734                                     average_time_ms(G1GCPhaseTimes::OptMergeRS);
 735       _analytics->report_cost_per_card_merge_ms(avg_time_merge_cards / total_cards_merged, this_pause_was_young_only);
 736     }
 737 
 738     // Update prediction for card scan
 739     size_t const total_cards_scanned = p->sum_thread_work_items(G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::ScanHRScannedCards) +
 740                                        p->sum_thread_work_items(G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::ScanHRScannedCards);
 741 
 742     if (total_cards_scanned > CardsNumSamplingThreshold) {
 743       double avg_time_dirty_card_scan = average_time_ms(G1GCPhaseTimes::ScanHR) +
 744                                         average_time_ms(G1GCPhaseTimes::OptScanHR);
 745 
 746       _analytics->report_cost_per_card_scan_ms(avg_time_dirty_card_scan / total_cards_scanned, this_pause_was_young_only);
 747     }
 748 
 749     // Update prediction for the ratio between cards from the remembered
 750     // sets and actually scanned cards from the remembered sets.
 751     // Cards from the remembered sets are all cards not duplicated by cards from
 752     // the logs.
 753     // Due to duplicates in the log buffers, the number of actually scanned cards
 754     // can be smaller than the cards in the log buffers.
 755     const size_t from_rs_length_cards = (total_cards_scanned > total_log_buffer_cards) ? total_cards_scanned - total_log_buffer_cards : 0;
 756     double merge_to_scan_ratio = 0.0;
 757     if (total_cards_scanned > 0) {
 758       merge_to_scan_ratio = (double) from_rs_length_cards / total_cards_scanned;
 759     }
 760    _analytics->report_card_merge_to_scan_ratio(merge_to_scan_ratio, this_pause_was_young_only);       
 761 
 762     const size_t recorded_rs_length = _collection_set->recorded_rs_length();


< prev index next >