8144145: G1GCPhaseTimes should allow externally accounted time
authorehelin
Sun, 29 Nov 2015 10:00:31 +0100
changeset 34612 ed475e8089ef
parent 34611 b8f6f834489b
child 34613 bb8d0781175e
8144145: G1GCPhaseTimes should allow externally accounted time Reviewed-by: ehelin, tschatzl
hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp
hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Sun Nov 29 10:00:23 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Sun Nov 29 10:00:31 2015 +0100
@@ -141,6 +141,7 @@
   assert(active_gc_threads <= _max_gc_threads, "The number of active threads must be <= the max number of threads");
   _active_gc_threads = active_gc_threads;
   _cur_expand_heap_time_ms = 0.0;
+  _external_accounted_time_ms = 0.0;
 
   for (int i = 0; i < GCParPhasesSentinel; i++) {
     _gc_par_phases[i]->reset();
@@ -185,9 +186,12 @@
 }
 
 double G1GCPhaseTimes::accounted_time_ms() {
+    // First subtract any externally accounted time
+    double misc_time_ms = _external_accounted_time_ms;
+
     // Subtract the root region scanning wait time. It's initialized to
     // zero at the start of the pause.
-    double misc_time_ms = _root_region_scan_wait_time_ms;
+    misc_time_ms += _root_region_scan_wait_time_ms;
 
     misc_time_ms += _cur_collection_par_time_ms;
 
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp	Sun Nov 29 10:00:23 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp	Sun Nov 29 10:00:31 2015 +0100
@@ -99,6 +99,8 @@
   double _cur_collection_start_sec;
   double _root_region_scan_wait_time_ms;
 
+  double _external_accounted_time_ms;
+
   double _recorded_young_cset_choice_time_ms;
   double _recorded_non_young_cset_choice_time_ms;
 
@@ -244,6 +246,10 @@
     _cur_verify_after_time_ms = time_ms;
   }
 
+  void inc_external_accounted_time_ms(double time_ms) {
+    _external_accounted_time_ms += time_ms;
+  }
+
   double accounted_time_ms();
 
   double cur_collection_start_sec() {