< prev index next >

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

Print this page
rev 7854 : imported patch 8027962-per-phase-timing-measurements-for-strong-roots-processing
rev 7855 : [mq]: 8027962-bengt-suggestions

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -156,14 +156,16 @@
   }
 }
 
 #endif
 
-G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) :
+G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads, uint num_ext_root_scan_phases) :
   _max_gc_threads(max_gc_threads),
+  _num_ext_root_scan_phases(num_ext_root_scan_phases),
   _last_gc_worker_start_times_ms(_max_gc_threads, "%.1lf", false),
   _last_ext_root_scan_times_ms(_max_gc_threads, "%.1lf"),
+  _last_ext_root_scan_phase_times_ms(NULL),
   _last_satb_filtering_times_ms(_max_gc_threads, "%.1lf"),
   _last_update_rs_times_ms(_max_gc_threads, "%.1lf"),
   _last_update_rs_processed_buffers(_max_gc_threads, "%d"),
   _last_scan_rs_times_ms(_max_gc_threads, "%.1lf"),
   _last_strong_code_root_scan_times_ms(_max_gc_threads, "%.1lf"),

@@ -177,10 +179,25 @@
   _last_redirty_logged_cards_processed_cards(_max_gc_threads, SIZE_FORMAT),
   _cur_string_dedup_queue_fixup_worker_times_ms(_max_gc_threads, "%.1lf"),
   _cur_string_dedup_table_fixup_worker_times_ms(_max_gc_threads, "%.1lf")
 {
   assert(max_gc_threads > 0, "Must have some GC threads");
+  if (track_ext_root_scan_phases()) {
+    _last_ext_root_scan_phase_times_ms = NEW_C_HEAP_ARRAY(WorkerDataArray<double>*, num_ext_root_scan_phases, mtGC);
+    for (uint i = 0; i < num_ext_root_scan_phases; i++) {
+      _last_ext_root_scan_phase_times_ms[i] = new WorkerDataArray<double>(_max_gc_threads, "%.1lf");
+    }
+  }
+}
+
+G1GCPhaseTimes::~G1GCPhaseTimes() {
+  if (track_ext_root_scan_phases()) {
+    for (uint i = 0; i < _num_ext_root_scan_phases; i++) {
+      delete _last_ext_root_scan_phase_times_ms[i];
+    }
+    FREE_C_HEAP_ARRAY(WorkerDataArray<double>*, _last_ext_root_scan_phase_times_ms);
+  }
 }
 
 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 nubmer of threads");

@@ -201,10 +218,13 @@
   _last_gc_worker_other_times_ms.reset();
 
   _last_redirty_logged_cards_time_ms.reset();
   _last_redirty_logged_cards_processed_cards.reset();
 
+  for (uint i = 0; i < _num_ext_root_scan_phases; i++) {
+    _last_ext_root_scan_phase_times_ms[i]->reset();
+  }
 }
 
 void G1GCPhaseTimes::note_gc_end() {
   _last_gc_worker_start_times_ms.verify();
   _last_ext_root_scan_times_ms.verify();

@@ -293,10 +313,16 @@
     print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms);
   }
   print_stats(1, "Parallel Time", _cur_collection_par_time_ms, _active_gc_threads);
   _last_gc_worker_start_times_ms.print(2, "GC Worker Start (ms)");
   _last_ext_root_scan_times_ms.print(2, "Ext Root Scanning (ms)");
+  if (track_ext_root_scan_phases()) {
+    for (uint i = 0; i < _num_ext_root_scan_phases; i++) {
+      WorkerDataArray<double>* data = _last_ext_root_scan_phase_times_ms[i];
+      data->print(3, G1CollectedHeap::ext_roots_task_string(i));
+    }
+  }
   if (_last_satb_filtering_times_ms.sum() > 0.0) {
     _last_satb_filtering_times_ms.print(2, "SATB Filtering (ms)");
   }
   _last_update_rs_times_ms.print(2, "Update RS (ms)");
     _last_update_rs_processed_buffers.print(3, "Processed Buffers");
< prev index next >