< prev index next >

src/share/vm/gc/g1/g1GCPhaseTimes.cpp

Print this page

        

@@ -28,10 +28,11 @@
 #include "gc/g1/g1GCPhaseTimes.hpp"
 #include "gc/g1/g1StringDedup.hpp"
 #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
 class LineBuffer: public StackObj {
 

@@ -131,10 +132,11 @@
 }
 
 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;
 
   for (int i = 0; i < GCParPhasesSentinel; i++) {

@@ -144,10 +146,11 @@
   _gc_par_phases[StringDedupQueueFixup]->set_enabled(G1StringDedup::is_enabled());
   _gc_par_phases[StringDedupTableFixup]->set_enabled(G1StringDedup::is_enabled());
 }
 
 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);
 
     double worker_known_time =

@@ -347,11 +350,11 @@
       print_thread_work_items(phase_id, phase->_thread_work_items);
     }
   }
 };
 
-void G1GCPhaseTimes::print(double pause_time_ms) {
+void G1GCPhaseTimes::print() {
   note_gc_end();
 
   G1GCParPhasePrinter par_phase_printer(this);
 
   if (_root_region_scan_wait_time_ms > 0.0) {

@@ -371,11 +374,11 @@
       par_phase_printer.print((GCParPhases) i);
     }
   }
   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);
   }
   if (G1CollectedHeap::heap()->evacuation_failed()) {
< prev index next >