src/hotspot/share/gc/g1/g1Policy.cpp
changeset 59198 92c98aa0f801
parent 58798 08e78887ff96
child 59319 9ee940f1de90
equal deleted inserted replaced
59197:bb3472aa26c8 59198:92c98aa0f801
    76   _total_concurrent_refined_cards(0),
    76   _total_concurrent_refined_cards(0),
    77   _total_concurrent_refinement_time(),
    77   _total_concurrent_refinement_time(),
    78   _bytes_allocated_in_old_since_last_gc(0),
    78   _bytes_allocated_in_old_since_last_gc(0),
    79   _initial_mark_to_mixed(),
    79   _initial_mark_to_mixed(),
    80   _collection_set(NULL),
    80   _collection_set(NULL),
    81   _bytes_copied_during_gc(0),
       
    82   _g1h(NULL),
    81   _g1h(NULL),
    83   _phase_times(new G1GCPhaseTimes(gc_timer, ParallelGCThreads)),
    82   _phase_times(new G1GCPhaseTimes(gc_timer, ParallelGCThreads)),
    84   _mark_remark_start_sec(0),
    83   _mark_remark_start_sec(0),
    85   _mark_cleanup_start_sec(0),
    84   _mark_cleanup_start_sec(0),
    86   _tenuring_threshold(MaxTenuringThreshold),
    85   _tenuring_threshold(MaxTenuringThreshold),
   551   phase_times()->record_cur_collection_start_sec(start_time_sec);
   550   phase_times()->record_cur_collection_start_sec(start_time_sec);
   552 
   551 
   553   record_concurrent_refinement_data(false /* is_full_collection */);
   552   record_concurrent_refinement_data(false /* is_full_collection */);
   554 
   553 
   555   _collection_set->reset_bytes_used_before();
   554   _collection_set->reset_bytes_used_before();
   556   _bytes_copied_during_gc = 0;
       
   557 
   555 
   558   // do that for any other surv rate groups
   556   // do that for any other surv rate groups
   559   _short_lived_surv_rate_group->stop_adding_regions();
   557   _short_lived_surv_rate_group->stop_adding_regions();
   560   _survivors_age_table.clear();
   558   _survivors_age_table.clear();
   561 
   559 
   645 }
   643 }
   646 
   644 
   647 // Anything below that is considered to be zero
   645 // Anything below that is considered to be zero
   648 #define MIN_TIMER_GRANULARITY 0.0000001
   646 #define MIN_TIMER_GRANULARITY 0.0000001
   649 
   647 
   650 void G1Policy::record_collection_pause_end(double pause_time_ms, size_t heap_used_bytes_before_gc) {
   648 void G1Policy::record_collection_pause_end(double pause_time_ms) {
   651   G1GCPhaseTimes* p = phase_times();
   649   G1GCPhaseTimes* p = phase_times();
   652 
   650 
   653   double end_time_sec = os::elapsedTime();
   651   double end_time_sec = os::elapsedTime();
   654 
   652 
   655   assert_used_and_recalculate_used_equal(_g1h);
       
   656   size_t cur_used_bytes = _g1h->used();
       
   657   bool this_pause_included_initial_mark = false;
   653   bool this_pause_included_initial_mark = false;
   658   bool this_pause_was_young_only = collector_state()->in_young_only_phase();
   654   bool this_pause_was_young_only = collector_state()->in_young_only_phase();
   659 
   655 
   660   bool update_stats = !_g1h->evacuation_failed();
   656   bool update_stats = !_g1h->evacuation_failed();
   661 
   657 
   776     if (_rs_length > recorded_rs_length) {
   772     if (_rs_length > recorded_rs_length) {
   777       rs_length_diff = _rs_length - recorded_rs_length;
   773       rs_length_diff = _rs_length - recorded_rs_length;
   778     }
   774     }
   779     _analytics->report_rs_length_diff((double) rs_length_diff);
   775     _analytics->report_rs_length_diff((double) rs_length_diff);
   780 
   776 
   781     size_t freed_bytes = heap_used_bytes_before_gc - cur_used_bytes;
   777     size_t copied_bytes = p->sum_thread_work_items(G1GCPhaseTimes::MergePSS, G1GCPhaseTimes::MergePSSCopiedBytes);
   782     size_t copied_bytes = _collection_set->bytes_used_before() - freed_bytes;
       
   783     double cost_per_byte_ms = 0.0;
       
   784 
   778 
   785     if (copied_bytes > 0) {
   779     if (copied_bytes > 0) {
   786       cost_per_byte_ms = (average_time_ms(G1GCPhaseTimes::ObjCopy) + average_time_ms(G1GCPhaseTimes::OptObjCopy)) / (double) copied_bytes;
   780       double cost_per_byte_ms = (average_time_ms(G1GCPhaseTimes::ObjCopy) + average_time_ms(G1GCPhaseTimes::OptObjCopy)) / copied_bytes;
   787       _analytics->report_cost_per_byte_ms(cost_per_byte_ms, collector_state()->mark_or_rebuild_in_progress());
   781       _analytics->report_cost_per_byte_ms(cost_per_byte_ms, collector_state()->mark_or_rebuild_in_progress());
   788     }
   782     }
   789 
   783 
   790     if (_collection_set->young_region_length() > 0) {
   784     if (_collection_set->young_region_length() > 0) {
   791       _analytics->report_young_other_cost_per_region_ms(young_other_time_ms() /
   785       _analytics->report_young_other_cost_per_region_ms(young_other_time_ms() /