--- old/src/hotspot/share/runtime/thread.cpp Wed Nov 15 10:22:51 2017 +++ new/src/hotspot/share/runtime/thread.cpp Wed Nov 15 10:22:50 2017 @@ -2016,6 +2016,10 @@ exit_type == JavaThread::normal_exit ? "exiting" : "detaching", os::current_thread_id()); + if (log_is_enabled(Debug, os, thread, timer)) { + _timer_exit_phase3.stop(); + _timer_exit_phase4.start(); + } // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread Threads::remove(this); @@ -2023,6 +2027,21 @@ if (ThreadLocalHandshakes) { cancel_handshake(); } + + if (log_is_enabled(Debug, os, thread, timer)) { + _timer_exit_phase4.stop(); + ResourceMark rm(this); + log_debug(os, thread, timer)("name='%s'" + ", exit-phase1=" JLONG_FORMAT + ", exit-phase2=" JLONG_FORMAT + ", exit-phase3=" JLONG_FORMAT + ", exit-phase4=" JLONG_FORMAT, + get_thread_name(), + _timer_exit_phase1.milliseconds(), + _timer_exit_phase2.milliseconds(), + _timer_exit_phase3.milliseconds(), + _timer_exit_phase4.milliseconds()); + } } #if INCLUDE_ALL_GCS