--- old/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2015-03-02 17:11:32.967356500 +0100 +++ new/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2015-03-02 17:11:32.863356504 +0100 @@ -4486,7 +4486,7 @@ void work(uint worker_id) { if (worker_id >= _n_workers) return; // no work needed this round - _g1h->g1_policy()->phase_times()->record_time(G1GCPhaseTimes::GCWorkerStart, worker_id, os::elapsedTime()); + _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::GCWorkerStart, worker_id, os::elapsedTime()); { ResourceMark rm; @@ -4568,8 +4568,8 @@ evac.do_void(); double elapsed_sec = os::elapsedTime() - start; double term_sec = pss.term_time(); - _g1h->g1_policy()->phase_times()->add_time(G1GCPhaseTimes::ObjCopy, worker_id, elapsed_sec - term_sec); - _g1h->g1_policy()->phase_times()->record_time(G1GCPhaseTimes::Termination, worker_id, term_sec); + _g1h->g1_policy()->phase_times()->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_id, elapsed_sec - term_sec); + _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::Termination, worker_id, term_sec); _g1h->g1_policy()->phase_times()->record_sub_count(G1GCPhaseTimes::Termination, worker_id, pss.term_attempts()); } _g1h->g1_policy()->record_thread_age_table(pss.age_table()); @@ -4586,7 +4586,7 @@ // destructors are executed here and are included as part of the // "GC Worker Time". } - _g1h->g1_policy()->phase_times()->record_time(G1GCPhaseTimes::GCWorkerEnd, worker_id, os::elapsedTime()); + _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::GCWorkerEnd, worker_id, os::elapsedTime()); } }; @@ -4648,19 +4648,19 @@ double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds() + buf_scan_non_heap_weak_roots.closure_app_seconds(); - g1_policy()->phase_times()->record_time(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec); + g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec); double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec; - g1_policy()->phase_times()->record_time(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec); + g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec); // During conc marking we have to filter the per-thread SATB buffers // to make sure we remove any oops into the CSet (which will show up // as implicitly live). - if (mark_in_progress() && !_process_strong_tasks->is_task_claimed(G1H_PS_filter_satb_buffers)) { + { G1GCPhaseTimesTracker x(g1_policy()->phase_times(), G1GCPhaseTimes::SATBFiltering, worker_i); - JavaThread::satb_mark_queue_set().filter_thread_buffers(); - } else { - g1_policy()->phase_times()->record_time(G1GCPhaseTimes::SATBFiltering, worker_i, 0.0); + if (!_process_strong_tasks->is_task_claimed(G1H_PS_filter_satb_buffers) && mark_in_progress()) { + JavaThread::satb_mark_queue_set().filter_thread_buffers(); + } } // Now scan the complement of the collection set. --- old/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp 2015-03-02 17:11:33.219356489 +0100 +++ new/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp 2015-03-02 17:11:33.119356493 +0100 @@ -1076,7 +1076,7 @@ if (update_stats) { double cost_per_card_ms = 0.0; if (_pending_cards > 0) { - cost_per_card_ms = phase_times()->average_time(G1GCPhaseTimes::UpdateRS) / (double) _pending_cards; + cost_per_card_ms = phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS) / (double) _pending_cards; _cost_per_card_ms_seq->add(cost_per_card_ms); } @@ -1084,7 +1084,7 @@ double cost_per_entry_ms = 0.0; if (cards_scanned > 10) { - cost_per_entry_ms = phase_times()->average_time(G1GCPhaseTimes::ScanRS) / (double) cards_scanned; + cost_per_entry_ms = phase_times()->average_time_ms(G1GCPhaseTimes::ScanRS) / (double) cards_scanned; if (_last_gc_was_young) { _cost_per_entry_ms_seq->add(cost_per_entry_ms); } else { @@ -1126,7 +1126,7 @@ double cost_per_byte_ms = 0.0; if (copied_bytes > 0) { - cost_per_byte_ms = phase_times()->average_time(G1GCPhaseTimes::ObjCopy) / (double) copied_bytes; + cost_per_byte_ms = phase_times()->average_time_ms(G1GCPhaseTimes::ObjCopy) / (double) copied_bytes; if (_in_marking_window) { _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); } else { @@ -1135,8 +1135,8 @@ } double all_other_time_ms = pause_time_ms - - (phase_times()->average_time(G1GCPhaseTimes::UpdateRS) + phase_times()->average_time(G1GCPhaseTimes::ScanRS) - + phase_times()->average_time(G1GCPhaseTimes::ObjCopy) + phase_times()->average_time(G1GCPhaseTimes::Termination)); + (phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS) + phase_times()->average_time_ms(G1GCPhaseTimes::ScanRS) + + phase_times()->average_time_ms(G1GCPhaseTimes::ObjCopy) + phase_times()->average_time_ms(G1GCPhaseTimes::Termination)); double young_other_time_ms = 0.0; if (young_cset_region_length() > 0) { @@ -1177,7 +1177,7 @@ // Note that _mmu_tracker->max_gc_time() returns the time in seconds. double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; - adjust_concurrent_refinement(phase_times()->average_time(G1GCPhaseTimes::UpdateRS), + adjust_concurrent_refinement(phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS), phase_times()->sub_count_sum(G1GCPhaseTimes::UpdateRS), update_rs_time_goal_ms); _collectionSetChooser->verify(); @@ -2120,19 +2120,19 @@ _other.add(pause_time_ms - phase_times->accounted_time_ms()); _root_region_scan_wait.add(phase_times->root_region_scan_wait_time_ms()); _parallel.add(phase_times->cur_collection_par_time_ms()); - _ext_root_scan.add(phase_times->average_time(G1GCPhaseTimes::ExtRootScan)); - _satb_filtering.add(phase_times->average_time(G1GCPhaseTimes::SATBFiltering)); - _update_rs.add(phase_times->average_time(G1GCPhaseTimes::UpdateRS)); - _scan_rs.add(phase_times->average_time(G1GCPhaseTimes::ScanRS)); - _obj_copy.add(phase_times->average_time(G1GCPhaseTimes::ObjCopy)); - _termination.add(phase_times->average_time(G1GCPhaseTimes::Termination)); - - double parallel_known_time = phase_times->average_time(G1GCPhaseTimes::ExtRootScan) + - phase_times->average_time(G1GCPhaseTimes::SATBFiltering) + - phase_times->average_time(G1GCPhaseTimes::UpdateRS) + - phase_times->average_time(G1GCPhaseTimes::ScanRS) + - phase_times->average_time(G1GCPhaseTimes::ObjCopy) + - phase_times->average_time(G1GCPhaseTimes::Termination); + _ext_root_scan.add(phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan)); + _satb_filtering.add(phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering)); + _update_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS)); + _scan_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::ScanRS)); + _obj_copy.add(phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy)); + _termination.add(phase_times->average_time_ms(G1GCPhaseTimes::Termination)); + + double parallel_known_time = phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan) + + phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering) + + phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS) + + phase_times->average_time_ms(G1GCPhaseTimes::ScanRS) + + phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy) + + phase_times->average_time_ms(G1GCPhaseTimes::Termination); double parallel_other_time = phase_times->cur_collection_par_time_ms() - parallel_known_time; _parallel_other.add(parallel_other_time); --- old/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp 2015-03-02 17:11:33.439356480 +0100 +++ new/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp 2015-03-02 17:11:33.339356484 +0100 @@ -73,13 +73,17 @@ va_end(ap); } + void print_cr() { + gclog_or_tty->print_cr("%s", _buffer); + _cur = _indent_level * INDENT_CHARS; + } + void append_and_print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) { va_list ap; va_start(ap, format); vappend(format, ap); va_end(ap); - gclog_or_tty->print_cr("%s", _buffer); - _cur = _indent_level * INDENT_CHARS; + print_cr(); } }; @@ -97,15 +101,7 @@ FREE_C_HEAP_ARRAY(T, _data); } -template <> -void WorkerDataArray::log_value(LineBuffer& buf, double value) { - buf.append("%.1lf", value * 1000); -} - -template <> -void WorkerDataArray::log_value(LineBuffer& buf, size_t value) { - buf.append(SIZE_FORMAT, value); -} +#ifndef PRODUCT template <> size_t WorkerDataArray::uninitialized() { @@ -118,66 +114,6 @@ } template -void WorkerDataArray::print() { - if (_log_level > G1Log::level() || !_enabled) { - return; - } - - if (_length == 1) { - // No need for min, max, average and sum for only one worker - LineBuffer buf(_indent_level); - buf.append("[%s: ", _title); - log_value(buf, _data[0]); - buf.append_and_print_cr("]"); - return; - } - - T min = _data[0]; - T max = _data[0]; - T sum = 0; - - LineBuffer buf(_indent_level); - buf.append("[%s:", _title); - for (uint i = 0; i < _length; ++i) { - T val = _data[i]; - min = MIN2(val, min); - max = MAX2(val, max); - sum += val; - if (G1Log::finest()) { - buf.append(" "); - log_value(buf, val); - } - } - - if (G1Log::finest()) { - buf.append_and_print_cr("%s", ""); - } - - double avg = (double)sum / (double)_length; - buf.append(" Min: "); - log_value(buf, min); - buf.append(", Avg: "); - buf.append("%.1lf", avg); // Always print average as a double - buf.append(", Max: "); - log_value(buf, max); - buf.append(", Diff: "); - log_value(buf, max - min); - if (_print_sum) { - // for things like the start and end times the sum is not - // that relevant - buf.append(", Sum: "); - log_value(buf, sum); - } - buf.append_and_print_cr("]"); - - if (_sub_count != NULL) { - _sub_count->print(); - } -} - -#ifndef PRODUCT - -template void WorkerDataArray::reset() { for (uint i = 0; i < _length; i++) { _data[i] = WorkerDataArray::uninitialized(); @@ -245,14 +181,14 @@ _gc_phases[SATBFiltering]->set_enabled(mark_in_progress); - _gc_phases[StringDedupQueueFixup]->set_enabled(G1StringDedup::is_enabled); - _gc_phases[StringDedupTableFixup]->set_enabled(G1StringDedup::is_enabled); + _gc_phases[StringDedupQueueFixup]->set_enabled(G1StringDedup::is_enabled()); + _gc_phases[StringDedupTableFixup]->set_enabled(G1StringDedup::is_enabled()); } void G1GCPhaseTimes::note_gc_end() { for (uint i = 0; i < _active_gc_threads; i++) { double worker_time = _gc_phases[GCWorkerEnd]->get(i) - _gc_phases[GCWorkerStart]->get(i); - record_time(GCWorkerTotal, i , worker_time); + record_time_secs(GCWorkerTotal, i , worker_time); double worker_known_time = _gc_phases[ExtRootScan]->get(i) + @@ -263,7 +199,7 @@ _gc_phases[ObjCopy]->get(i) + _gc_phases[Termination]->get(i); - record_time(Other, i, worker_time - worker_known_time); + record_time_secs(Other, i, worker_time - worker_known_time); } for (int i = 0; i < Sentinel; i++) { @@ -309,13 +245,15 @@ } void G1GCPhaseTimes::print(double pause_time_sec) { + G1GCPhasePrinter phase_printer(this); + if (_root_region_scan_wait_time_ms > 0.0) { 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); for (int i = 0; i <= GCMainPhasesLast; i++) { - _gc_phases[i]->print(); + phase_printer.print((GCPhases) i); } print_stats(1, "Code Root Fixup", _cur_collection_code_root_fixup_time_ms); @@ -323,7 +261,7 @@ if (G1StringDedup::is_enabled()) { print_stats(1, "String Dedup Fixup", _cur_string_dedup_fixup_time_ms, _active_gc_threads); for (int i = StringDedupPhasesFirst; i <= StringDedupPhasesLast; i++) { - _gc_phases[i]->print(); + phase_printer.print((GCPhases) i); } } print_stats(1, "Clear CT", _cur_clear_ct_time_ms); @@ -348,7 +286,7 @@ print_stats(2, "Ref Proc", _cur_ref_proc_time_ms); print_stats(2, "Ref Enq", _cur_ref_enq_time_ms); print_stats(2, "Redirty Cards", _recorded_redirty_logged_cards_time_ms); - _gc_phases[RedirtyCards]->print(); + phase_printer.print(RedirtyCards); if (G1EagerReclaimHumongousObjects) { print_stats(2, "Humongous Register", _cur_fast_reclaim_humongous_register_time_ms); if (G1Log::finest()) { @@ -378,5 +316,84 @@ } G1GCPhaseTimesTracker::~G1GCPhaseTimesTracker() { - _phase_times->record_time(_phase, _worker_id, os::elapsedTime() - _start_time); + _phase_times->record_time_secs(_phase, _worker_id, os::elapsedTime() - _start_time); +} + +void G1GCPhasePrinter::print_single_length(G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* phase) { + // No need for min, max, average and sum for only one worker + LineBuffer buf(phase->_indent_level); + buf.append_and_print_cr("[%s: %.1lf]", phase->_title, _phase_times->get_time_ms(phase_id, 0)); + + if (phase->_sub_count != NULL) { + LineBuffer buf2(phase->_sub_count->_indent_level); + buf2.append_and_print_cr("[%s: "SIZE_FORMAT"]", phase->_sub_count->_title, _phase_times->sub_count_sum(phase_id)); + } +} + +void G1GCPhasePrinter::print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* phase) { + for (uint i = 0; i < phase->_length; ++i) { + buf.append(" %.1lf", _phase_times->get_time_ms(phase_id, i)); + } + buf.print_cr(); +} + +void G1GCPhasePrinter::print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* sub_count) { + for (uint i = 0; i < sub_count->_length; ++i) { + buf.append(" " SIZE_FORMAT, _phase_times->get_sub_count(phase_id, i)); + } + buf.print_cr(); +} + +void G1GCPhasePrinter::print_sub_count(G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* sub_count) { + LineBuffer buf(sub_count->_indent_level); + buf.append("[%s:", sub_count->_title); + + if (G1Log::finest()) { + print_count_values(buf, phase_id, sub_count); + } + + assert(sub_count->_print_sum, err_msg("%s does not have print sum true even though it is a count", sub_count->_title)); + + buf.append_and_print_cr(" Min: " SIZE_FORMAT ", Avg: %.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT ", Sum: " SIZE_FORMAT "]", + _phase_times->min_sub_count(phase_id), _phase_times->average_sub_count(phase_id), _phase_times->max_sub_count(phase_id), + _phase_times->max_sub_count(phase_id) - _phase_times->min_sub_count(phase_id), _phase_times->sum_sub_count(phase_id)); +} + +void G1GCPhasePrinter::print_multi_length(G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* phase) { + LineBuffer buf(phase->_indent_level); + buf.append("[%s:", phase->_title); + + if (G1Log::finest()) { + print_time_values(buf, phase_id, phase); + } + + buf.append(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf", + _phase_times->min_time_ms(phase_id), _phase_times->average_time_ms(phase_id), _phase_times->max_time_ms(phase_id), + _phase_times->max_time_ms(phase_id) - _phase_times->min_time_ms(phase_id)); + + if (phase->_print_sum) { + // for things like the start and end times the sum is not + // that relevant + buf.append(", Sum: %.1lf", _phase_times->sum_time_ms(phase_id)); + } + + buf.append_and_print_cr("]"); + + if (phase->_sub_count != NULL) { + print_sub_count(phase_id, phase->_sub_count); + } +} + +void G1GCPhasePrinter::print(G1GCPhaseTimes::GCPhases phase_id) { + WorkerDataArray* phase = _phase_times->_gc_phases[phase_id]; + + if (phase->_log_level > G1Log::level() || !phase->_enabled) { + return; + } + + if (phase->_length == 1) { + print_single_length(phase_id, phase); + } else { + print_multi_length(phase_id, phase); + } } --- old/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp 2015-03-02 17:11:33.635356472 +0100 +++ new/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp 2015-03-02 17:11:33.535356476 +0100 @@ -31,6 +31,7 @@ template class WorkerDataArray : public CHeapObj { + friend class G1GCPhasePrinter; T* _data; uint _length; const char* _title; @@ -49,10 +50,10 @@ // without having to worry about the cost. bool _has_new_data; T _sum; + T _min; + T _max; double _average; - void log_value(LineBuffer& buf, T value); - public: WorkerDataArray(uint length, const char* title, bool print_sum, int log_level, uint indent_level); @@ -62,6 +63,8 @@ _sub_count = sub_count; } + WorkerDataArray* sub_count() { return _sub_count; } + void set(uint worker_i, T value) { assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); assert(_data[worker_i] == WorkerDataArray::uninitialized(), err_msg("Overwriting data for worker %d in %s", worker_i, _title)); @@ -74,11 +77,6 @@ _sub_count->set(worker_i, value); } - size_t sub_count_sum() { - assert(_sub_count != NULL, "No sub count"); - return _sub_count->sum(); - } - T get(uint worker_i) { assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length)); assert(_data[worker_i] != WorkerDataArray::uninitialized(), err_msg("No data to add to for worker %d", worker_i)); @@ -93,20 +91,24 @@ } double average(){ - if (_has_new_data) { - calculate_totals(); - } + calculate_totals(); return _average; } T sum() { - if (_has_new_data) { - calculate_totals(); - } + calculate_totals(); return _sum; } - void print(); + T minimum() { + calculate_totals(); + return _min; + } + + T maximum() { + calculate_totals(); + return _max; + } void reset() PRODUCT_RETURN; void verify() PRODUCT_RETURN; @@ -118,9 +120,18 @@ private: void calculate_totals(){ + if (!_has_new_data) { + return; + } + _sum = (T)0; + _min = _data[0]; + _max = _min; for (uint i = 0; i < _length; ++i) { - _sum += _data[i]; + T val = _data[i]; + _sum += val; + _min = MIN2(_min, val); + _max = MAX2(_max, val); } _average = (double)_sum / (double)_length; _has_new_data = false; @@ -128,6 +139,8 @@ }; class G1GCPhaseTimes : public CHeapObj { + friend class G1GCPhasePrinter; + uint _active_gc_threads; uint _max_gc_threads; @@ -206,26 +219,75 @@ void note_gc_end(); void print(double pause_time_sec); - void record_time(GCPhases phase, uint worker_i, double time) { - _gc_phases[phase]->set(worker_i, time); + // record the time a phase took in seconds + void record_time_secs(GCPhases phase, uint worker_i, double secs) { + _gc_phases[phase]->set(worker_i, secs); } - void add_time(GCPhases phase, uint worker_i, double time) { - _gc_phases[phase]->add(worker_i, time); + // add a number of seconds to a phase + void add_time_secs(GCPhases phase, uint worker_i, double secs) { + _gc_phases[phase]->add(worker_i, secs); } void record_sub_count(GCPhases phase, uint worker_i, size_t count) { _gc_phases[phase]->set_sub_count(worker_i, count); } - double average_time(GCPhases phase) { - return _gc_phases[phase]->average(); + // return the average time for a phase in milliseconds + double average_time_ms(GCPhases phase) { + return _gc_phases[phase]->average() * 1000.0; } size_t sub_count_sum(GCPhases phase) { - return _gc_phases[phase]->sub_count_sum(); + assert(_gc_phases[phase]->sub_count() != NULL, "No sub count"); + return _gc_phases[phase]->sub_count()->sum(); + } + + private: + + double get_time_ms(GCPhases phase, uint worker_i) { + return _gc_phases[phase]->get(worker_i) * 1000.0; } + double sum_time_ms(GCPhases phase) { + return _gc_phases[phase]->sum() * 1000.0; + } + + double min_time_ms(GCPhases phase) { + return _gc_phases[phase]->minimum() * 1000.0; + } + + double max_time_ms(GCPhases phase) { + return _gc_phases[phase]->maximum() * 1000.0; + } + + size_t get_sub_count(GCPhases phase, uint worker_i) { + assert(_gc_phases[phase]->sub_count() != NULL, "No sub count"); + return _gc_phases[phase]->sub_count()->get(worker_i); + } + + size_t sum_sub_count(GCPhases phase) { + assert(_gc_phases[phase]->sub_count() != NULL, "No sub count"); + return _gc_phases[phase]->sub_count()->sum(); + } + + double average_sub_count(GCPhases phase) { + assert(_gc_phases[phase]->sub_count() != NULL, "No sub count"); + return _gc_phases[phase]->sub_count()->average(); + } + + size_t min_sub_count(GCPhases phase) { + assert(_gc_phases[phase]->sub_count() != NULL, "No sub count"); + return _gc_phases[phase]->sub_count()->minimum(); + } + + size_t max_sub_count(GCPhases phase) { + assert(_gc_phases[phase]->sub_count() != NULL, "No sub count"); + return _gc_phases[phase]->sub_count()->maximum(); + } + + public: + void record_clear_ct_time(double ms) { _cur_clear_ct_time_ms = ms; } @@ -362,4 +424,16 @@ ~G1GCPhaseTimesTracker(); }; +class G1GCPhasePrinter : public StackObj { + G1GCPhaseTimes* _phase_times; + void print_single_length(G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* phase); + void print_multi_length(G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* phase); + void print_sub_count(G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* sub_count); + void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* phase); + void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCPhases phase_id, WorkerDataArray* phase); + public: + G1GCPhasePrinter(G1GCPhaseTimes* phase_times) : _phase_times(phase_times) {} + void print(G1GCPhaseTimes::GCPhases phase_id); +}; + #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP --- old/src/share/vm/gc_implementation/g1/g1RemSet.cpp 2015-03-02 17:11:33.823356464 +0100 +++ new/src/share/vm/gc_implementation/g1/g1RemSet.cpp 2015-03-02 17:11:33.723356468 +0100 @@ -248,8 +248,8 @@ assert(_cards_scanned != NULL, "invariant"); _cards_scanned[worker_i] = scanRScl.cards_done(); - _g1p->phase_times()->record_time(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec); - _g1p->phase_times()->record_time(G1GCPhaseTimes::CodeRoots, worker_i, scanRScl.strong_code_root_scan_time_sec()); + _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec); + _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, scanRScl.strong_code_root_scan_time_sec()); } // Closure used for updating RSets and recording references that --- old/src/share/vm/gc_implementation/g1/g1StringDedup.cpp 2015-03-02 17:11:34.019356456 +0100 +++ new/src/share/vm/gc_implementation/g1/g1StringDedup.cpp 2015-03-02 17:11:33.919356460 +0100 @@ -142,8 +142,8 @@ double queue_fixup_time_sec = table_fixup_start - queue_fixup_start; double table_fixup_time_sec = os::elapsedTime() - table_fixup_start; G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); - g1p->phase_times()->record_time(G1GCPhaseTimes::StringDedupQueueFixup, worker_id, queue_fixup_time_sec); - g1p->phase_times()->record_time(G1GCPhaseTimes::StringDedupTableFixup, worker_id, table_fixup_time_sec); + g1p->phase_times()->record_time_secs(G1GCPhaseTimes::StringDedupQueueFixup, worker_id, queue_fixup_time_sec); + g1p->phase_times()->record_time_secs(G1GCPhaseTimes::StringDedupTableFixup, worker_id, table_fixup_time_sec); } };