--- hotspot-main-closed/src/share/vm/gc/g1/concurrentG1RefineThread.cpp 2015-10-20 14:11:20.216745371 -0700 +++ hotspot-main-patch/src/share/vm/gc/g1/concurrentG1RefineThread.cpp 2015-10-19 14:52:42.637634670 -0700 @@ -105,9 +105,16 @@ void ConcurrentG1RefineThread::run_young_rs_sampling() { DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + //JZ + double sample_young_list_start, sample_young_list_end; + double wait_monitor_start, wait_monitor_end; + double wait_service_interval_start, wait_service_interval_end; _vtime_start = os::elapsedVTime(); + while(!_should_terminate) { + sample_young_list_start = os::elapsedTime(); sample_young_list_rs_lengths(); + sample_young_list_end = os::elapsedTime(); if (os::supports_vtime()) { _vtime_accum = (os::elapsedVTime() - _vtime_start); @@ -115,11 +122,17 @@ _vtime_accum = 0.0; } + wait_monitor_start = os::elapsedTime(); MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag); + wait_monitor_end = os::elapsedTime(); + gclog_or_tty->print_cr("sample_young_list_start %8.4lf, sample_young_list_time %8.4lf, monitor_wait_time %8.4lf", sample_young_list_start, sample_young_list_end-sample_young_list_start, wait_monitor_end-wait_monitor_start); if (_should_terminate) { break; } + wait_service_interval_start = os::elapsedTime(); _monitor->wait(Mutex::_no_safepoint_check_flag, G1ConcRefinementServiceIntervalMillis); + wait_service_interval_end = os::elapsedTime(); + gclog_or_tty->print_cr("wait_service_interval %8.4lf", wait_service_interval_end-wait_service_interval_start); } } @@ -170,13 +183,17 @@ void ConcurrentG1RefineThread::run() { initialize_in_thread(); wait_for_universe_init(); + double start, end; + start = os::elapsedTime(); if (_worker_id >= cg1r()->worker_thread_num()) { + gclog_or_tty->print_cr("start run_young_rs_sampleing %8.4lf", start); run_young_rs_sampling(); terminate(); return; } + gclog_or_tty->print_cr("start concurrentRefinementThread %8.4lf", start); _vtime_start = os::elapsedVTime(); while (!_should_terminate) { DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); @@ -225,30 +242,45 @@ _vtime_accum = 0.0; } } + end = os::elapsedTime(); + gclog_or_tty->print_cr("end %8.4lf, diff %8.4lf", end, end-start); assert(_should_terminate, "just checking"); terminate(); } void ConcurrentG1RefineThread::stop() { // it is ok to take late safepoints here, if needed + double terminator_lock_start, terminator_lock_end; + double monitor_notify_start, monitor_notify_end; + double terminator_wait_start, terminator_wait_end; { + terminator_lock_start = os::elapsedTime(); MutexLockerEx mu(Terminator_lock); _should_terminate = true; + terminator_lock_end = os::elapsedTime(); + gclog_or_tty->print_cr("terminator_lock_start %8.4lf", terminator_lock_start); } { + monitor_notify_start = os::elapsedTime(); MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag); _monitor->notify(); + monitor_notify_end = os::elapsedTime(); } { + terminator_wait_start = os::elapsedTime(); MutexLockerEx mu(Terminator_lock); while (!_has_terminated) { Terminator_lock->wait(); } + terminator_wait_end = os::elapsedTime(); } if (G1TraceConcRefinement) { gclog_or_tty->print_cr("G1-Refine-stop"); } + + //JZ + gclog_or_tty->print_cr("terminator_lock_time %8.4lf, monitor_notify_time %8.4lf, terminator_wait_time %8.4lf", terminator_lock_end-terminator_lock_start, monitor_notify_end-monitor_notify_start, terminator_wait_end-terminator_wait_start); }