--- old/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp 2015-02-17 09:48:40.420485575 +0100 +++ new/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp 2015-02-17 09:48:40.360483833 +0100 @@ -107,14 +107,37 @@ } }; +class GCPhaseTimeTracker VALUE_OBJ_CLASS_SPEC { +private: + friend class G1GCPhaseTimes; + + WorkerDataArray** _data; + uint _num_phases; + uint _worker_id; +public: + GCPhaseTimeTracker(WorkerDataArray** data, uint num_phases, uint worker_id) : + _data(data), _num_phases(num_phases), _worker_id(worker_id) { } + + bool active() const { return _num_phases > 0; } + + void set_value(uint phase, double value) { + assert(_data != NULL, "just checking"); + _data[phase]->set(_worker_id, value); + } +}; + class G1GCPhaseTimes : public CHeapObj { private: uint _active_gc_threads; uint _max_gc_threads; + uint _num_ext_root_scan_phases; + + bool track_ext_root_scan_phases() const { return _num_ext_root_scan_phases > 0; } WorkerDataArray _last_gc_worker_start_times_ms; WorkerDataArray _last_ext_root_scan_times_ms; + WorkerDataArray** _last_ext_root_scan_phase_times_ms; WorkerDataArray _last_satb_filtering_times_ms; WorkerDataArray _last_update_rs_times_ms; WorkerDataArray _last_update_rs_processed_buffers; @@ -171,7 +194,12 @@ void print_stats(int level, const char* str, double value, uint workers); public: - G1GCPhaseTimes(uint max_gc_threads); + G1GCPhaseTimes(uint max_gc_threads, uint num_ext_root_scan_phases); + virtual ~G1GCPhaseTimes(); + + WorkerDataArray** get_ext_root_scan_phase_times() const { return _last_ext_root_scan_phase_times_ms; } + uint num_ext_root_scan_phases() const { return _num_ext_root_scan_phases; } + void note_gc_start(uint active_gc_threads); void note_gc_end(); void print(double pause_time_sec);