8059216: Make PrintGCApplicationStoppedTime print information about stopping threads
authorvkempik
Tue, 28 Oct 2014 18:41:34 +0400
changeset 27462 2fef16b8c70f
parent 27461 90e9e0f9c0c5
child 27463 335715f6906c
child 27464 37671dcc4d8d
8059216: Make PrintGCApplicationStoppedTime print information about stopping threads Reviewed-by: dholmes, brutisso
hotspot/src/share/vm/services/runtimeService.cpp
hotspot/src/share/vm/services/runtimeService.hpp
--- a/hotspot/src/share/vm/services/runtimeService.cpp	Thu Oct 30 18:38:42 2014 -0400
+++ b/hotspot/src/share/vm/services/runtimeService.cpp	Tue Oct 28 18:41:34 2014 +0400
@@ -38,6 +38,7 @@
 PerfCounter*  RuntimeService::_total_safepoints = NULL;
 PerfCounter*  RuntimeService::_safepoint_time_ticks = NULL;
 PerfCounter*  RuntimeService::_application_time_ticks = NULL;
+double RuntimeService::_last_safepoint_sync_time_sec = 0.0;
 
 void RuntimeService::init() {
   // Make sure the VM version is initialized
@@ -96,6 +97,7 @@
 
   // 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()) {
@@ -108,6 +110,9 @@
   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() {
@@ -119,8 +124,10 @@
     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
--- a/hotspot/src/share/vm/services/runtimeService.hpp	Thu Oct 30 18:38:42 2014 -0400
+++ b/hotspot/src/share/vm/services/runtimeService.hpp	Tue Oct 28 18:41:34 2014 +0400
@@ -37,6 +37,7 @@
 
   static TimeStamp _safepoint_timer;
   static TimeStamp _app_timer;
+  static double _last_safepoint_sync_time_sec;
 
 public:
   static void init();