@@ -58,7 +58,7 @@ G1Policy::G1Policy(STWGCTimer* gc_timer) :
5858 _old_gen_alloc_tracker(),
5959 _ihop_control(create_ihop_control(&_old_gen_alloc_tracker, &_predictor)),
6060 _policy_counters(new GCPolicyCounters(" GarbageFirst" , 1 , 2 )),
61- _full_collection_start_sec (0.0 ),
61+ _cur_pause_start_sec (0.0 ),
6262 _young_list_desired_length(0 ),
6363 _young_list_target_length(0 ),
6464 _eden_surv_rate_group(new G1SurvRateGroup()),
@@ -74,8 +74,6 @@ G1Policy::G1Policy(STWGCTimer* gc_timer) :
7474 _g1h(nullptr ),
7575 _phase_times_timer(gc_timer),
7676 _phase_times(nullptr ),
77- _mark_remark_start_sec(0 ),
78- _mark_cleanup_start_sec(0 ),
7977 _tenuring_threshold(MaxTenuringThreshold),
8078 _max_survivor_regions(0 ),
8179 _survivors_age_table(true )
@@ -572,7 +570,7 @@ void G1Policy::revise_young_list_target_length(size_t card_rs_length, size_t cod
572570}
573571
574572void G1Policy::record_full_collection_start () {
575- _full_collection_start_sec = os::elapsedTime ();
573+ record_pause_start_time ();
576574 // Release the future to-space so that it is available for compaction into.
577575 collector_state ()->set_in_young_only_phase (false );
578576 collector_state ()->set_in_full_gc (true );
@@ -605,7 +603,8 @@ void G1Policy::record_full_collection_end() {
605603
606604 _old_gen_alloc_tracker.reset_after_gc (_g1h->humongous_regions_count () * G1HeapRegion::GrainBytes);
607605
608- record_pause (G1GCPauseType::FullGC, _full_collection_start_sec, end_sec);
606+ double start_time_sec = cur_pause_start_sec ();
607+ record_pause (G1GCPauseType::FullGC, start_time_sec, end_sec);
609608}
610609
611610static void log_refinement_stats (const char * kind, const G1ConcurrentRefineStats& stats) {
@@ -650,7 +649,7 @@ void G1Policy::record_concurrent_refinement_stats(size_t pending_cards,
650649
651650 // Record mutator's card logging rate.
652651 double mut_start_time = _analytics->prev_collection_pause_end_ms ();
653- double mut_end_time = phase_times ()-> cur_collection_start_sec () * MILLIUNITS;
652+ double mut_end_time = cur_pause_start_sec () * MILLIUNITS;
654653 double mut_time = mut_end_time - mut_start_time;
655654 // Unlike above for conc-refine rate, here we should not require a
656655 // non-empty sample, since an application could go some time with only
@@ -669,8 +668,13 @@ bool G1Policy::should_retain_evac_failed_region(uint index) const {
669668 return live_bytes < threshold;
670669}
671670
672- void G1Policy::record_young_collection_start () {
671+ void G1Policy::record_pause_start_time () {
673672 Ticks now = Ticks::now ();
673+ _cur_pause_start_sec = now.seconds ();
674+ }
675+
676+ void G1Policy::record_young_collection_start () {
677+ record_pause_start_time ();
674678 // We only need to do this here as the policy will only be applied
675679 // to the GC we're about to start. so, no point is calculating this
676680 // every time we calculate / recalculate the target young length.
@@ -681,8 +685,6 @@ void G1Policy::record_young_collection_start() {
681685 max_survivor_regions (), _g1h->num_used_regions (), _g1h->max_num_regions ());
682686 assert_used_and_recalculate_used_equal (_g1h);
683687
684- phase_times ()->record_cur_collection_start_sec (now.seconds ());
685-
686688 // do that for any other surv rate groups
687689 _eden_surv_rate_group->stop_adding_regions ();
688690 _survivors_age_table.clear ();
@@ -695,19 +697,12 @@ void G1Policy::record_concurrent_mark_init_end() {
695697 collector_state ()->set_in_concurrent_start_gc (false );
696698}
697699
698- void G1Policy::record_concurrent_mark_remark_start () {
699- _mark_remark_start_sec = os::elapsedTime ();
700- }
701-
702700void G1Policy::record_concurrent_mark_remark_end () {
703701 double end_time_sec = os::elapsedTime ();
704- double elapsed_time_ms = (end_time_sec - _mark_remark_start_sec)*1000.0 ;
702+ double start_time_sec = cur_pause_start_sec ();
703+ double elapsed_time_ms = (end_time_sec - start_time_sec) * 1000.0 ;
705704 _analytics->report_concurrent_mark_remark_times_ms (elapsed_time_ms);
706- record_pause (G1GCPauseType::Remark, _mark_remark_start_sec, end_time_sec);
707- }
708-
709- void G1Policy::record_concurrent_mark_cleanup_start () {
710- _mark_cleanup_start_sec = os::elapsedTime ();
705+ record_pause (G1GCPauseType::Remark, start_time_sec, end_time_sec);
711706}
712707
713708G1CollectionSetCandidates* G1Policy::candidates () const {
@@ -795,7 +790,7 @@ double G1Policy::logged_cards_processing_time() const {
795790void G1Policy::record_young_collection_end (bool concurrent_operation_is_full_mark, bool allocation_failure) {
796791 G1GCPhaseTimes* p = phase_times ();
797792
798- double start_time_sec = phase_times ()-> cur_collection_start_sec ();
793+ double start_time_sec = cur_pause_start_sec ();
799794 double end_time_sec = Ticks::now ().seconds ();
800795 double pause_time_ms = (end_time_sec - start_time_sec) * 1000.0 ;
801796
@@ -1321,10 +1316,11 @@ void G1Policy::record_concurrent_mark_cleanup_end(bool has_rebuilt_remembered_se
13211316 collector_state ()->set_clear_bitmap_in_progress (true );
13221317
13231318 double end_sec = os::elapsedTime ();
1324- double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0 ;
1319+ double start_sec = cur_pause_start_sec ();
1320+ double elapsed_time_ms = (end_sec - start_sec) * 1000.0 ;
13251321 _analytics->report_concurrent_mark_cleanup_times_ms (elapsed_time_ms);
13261322
1327- record_pause (G1GCPauseType::Cleanup, _mark_cleanup_start_sec , end_sec);
1323+ record_pause (G1GCPauseType::Cleanup, start_sec , end_sec);
13281324}
13291325
13301326void G1Policy::abandon_collection_set_candidates () {
0 commit comments