--- old/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp 2015-02-17 09:48:40.067475325 +0100 +++ new/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp 2015-02-17 09:48:40.007473582 +0100 @@ -29,6 +29,7 @@ #include "gc_implementation/g1/g1Log.hpp" #include "gc_implementation/g1/g1StringDedup.hpp" #include "runtime/atomic.inline.hpp" +#include "g1CollectedHeap.hpp" // Helper class for avoiding interleaved logging class LineBuffer: public StackObj { @@ -145,6 +146,7 @@ for (uint i = 0; i < _length; i++) { _data[i] = (T)_uninitialized; } + _has_new_data = true; } template @@ -158,10 +160,12 @@ #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"), @@ -179,6 +183,21 @@ _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*, 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(_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*, _last_ext_root_scan_phase_times_ms); + } } void G1GCPhaseTimes::note_gc_start(uint active_gc_threads) { @@ -203,6 +222,9 @@ _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() { @@ -295,6 +317,12 @@ 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* 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)"); }