From fa27980b832c58f2862e6a79e4a4142d13227b4b Mon Sep 17 00:00:00 2001 From: vkempik Date: Tue, 28 Oct 2014 18:41:34 +0400 Subject: [PATCH] 8059216: Make PrintGCApplicationStoppedTime print information about stopping threads Reviewed-by: dholmes, brutisso --- src/share/vm/services/runtimeService.cpp | 11 +++++++++-- src/share/vm/services/runtimeService.hpp | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/share/vm/services/runtimeService.cpp b/src/share/vm/services/runtimeService.cpp index 379b8f3ff..9df9fe696 100644 --- a/src/share/vm/services/runtimeService.cpp +++ b/src/share/vm/services/runtimeService.cpp @@ -46,6 +46,7 @@ PerfCounter* RuntimeService::_application_time_ticks = NULL; PerfCounter* RuntimeService::_thread_interrupt_signaled_count = NULL; PerfCounter* RuntimeService::_interrupted_before_count = NULL; PerfCounter* RuntimeService::_interrupted_during_count = NULL; +double RuntimeService::_last_safepoint_sync_time_sec = 0.0; void RuntimeService::init() { // Make sure the VM version is initialized @@ -128,6 +129,7 @@ void RuntimeService::record_safepoint_begin() { // update the time stamp to begin recording safepoint time _safepoint_timer.update(); + _last_safepoint_sync_time_sec = 0.0; if (UsePerfData) { _total_safepoints->inc(); if (_app_timer.is_updated()) { @@ -140,6 +142,9 @@ void RuntimeService::record_safepoint_synchronized() { if (UsePerfData) { _sync_time_ticks->inc(_safepoint_timer.ticks_since_update()); } + if (PrintGCApplicationStoppedTime) { + _last_safepoint_sync_time_sec = last_safepoint_time_sec(); + } } void RuntimeService::record_safepoint_end() { @@ -155,8 +160,10 @@ void RuntimeService::record_safepoint_end() { gclog_or_tty->date_stamp(PrintGCDateStamps); gclog_or_tty->stamp(PrintGCTimeStamps); gclog_or_tty->print_cr("Total time for which application threads " - "were stopped: %3.7f seconds", - last_safepoint_time_sec()); + "were stopped: %3.7f seconds, " + "Stopping threads took: %3.7f seconds", + last_safepoint_time_sec(), + _last_safepoint_sync_time_sec); } // update the time stamp to begin recording app time diff --git a/src/share/vm/services/runtimeService.hpp b/src/share/vm/services/runtimeService.hpp index 8de0ebf6f..80ed1db71 100644 --- a/src/share/vm/services/runtimeService.hpp +++ b/src/share/vm/services/runtimeService.hpp @@ -40,6 +40,7 @@ private: static TimeStamp _safepoint_timer; static TimeStamp _app_timer; + static double _last_safepoint_sync_time_sec; public: static void init(); -- GitLab