hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp
changeset 35907 57bdb6243428
parent 35887 169f3d39af5b
child 36367 313c87c050f7
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Tue Feb 02 09:51:24 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Tue Feb 02 10:50:08 2016 +0100
@@ -30,6 +30,7 @@
 #include "gc/g1/workerDataArray.inline.hpp"
 #include "memory/allocation.hpp"
 #include "logging/log.hpp"
+#include "runtime/timer.hpp"
 #include "runtime/os.hpp"
 
 // Helper class for avoiding interleaved logging
@@ -133,6 +134,7 @@
 void G1GCPhaseTimes::note_gc_start(uint active_gc_threads) {
   assert(active_gc_threads > 0, "The number of threads must be > 0");
   assert(active_gc_threads <= _max_gc_threads, "The number of active threads must be <= the max number of threads");
+  _gc_start_counter = os::elapsed_counter();
   _active_gc_threads = active_gc_threads;
   _cur_expand_heap_time_ms = 0.0;
   _external_accounted_time_ms = 0.0;
@@ -146,6 +148,7 @@
 }
 
 void G1GCPhaseTimes::note_gc_end() {
+  _gc_pause_time_ms = TimeHelper::counter_to_millis(os::elapsed_counter() - _gc_start_counter);
   for (uint i = 0; i < _active_gc_threads; i++) {
     double worker_time = _gc_par_phases[GCWorkerEnd]->get(i) - _gc_par_phases[GCWorkerStart]->get(i);
     record_time_secs(GCWorkerTotal, i , worker_time);
@@ -349,7 +352,7 @@
   }
 };
 
-void G1GCPhaseTimes::print(double pause_time_ms) {
+void G1GCPhaseTimes::print() {
   note_gc_end();
 
   G1GCParPhasePrinter par_phase_printer(this);
@@ -373,7 +376,7 @@
   }
   print_stats(Indents[1], "Clear CT", _cur_clear_ct_time_ms);
   print_stats(Indents[1], "Expand Heap After Collection", _cur_expand_heap_time_ms);
-  double misc_time_ms = pause_time_ms - accounted_time_ms();
+  double misc_time_ms = _gc_pause_time_ms - accounted_time_ms();
   print_stats(Indents[1], "Other", misc_time_ms);
   if (_cur_verify_before_time_ms > 0.0) {
     print_stats(Indents[2], "Verify Before", _cur_verify_before_time_ms);