< prev index next >

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

Print this page
rev 49680 : imported patch 6672778-partial-queue-trimming
rev 49681 : imported patch 6672778-refactoring
rev 49682 : [mq]: 6672778-stefanj-review

*** 24,33 **** --- 24,34 ---- #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1HotCardCache.hpp" + #include "gc/g1/g1ParScanThreadState.inline.hpp" #include "gc/g1/g1StringDedup.hpp" #include "gc/shared/workerDataArray.inline.hpp" #include "memory/resourceArea.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp"
*** 227,239 **** // add a number of seconds to a phase void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) { _gc_par_phases[phase]->add(worker_i, secs); } ! void G1GCPhaseTimes::move_time_secs(GCParPhases from, GCParPhases to, uint worker_i, double secs) { ! add_time_secs(from, worker_i, -secs); ! add_time_secs(to, worker_i, secs); } void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index) { _gc_par_phases[phase]->set_thread_work_item(worker_i, count, index); } --- 228,243 ---- // add a number of seconds to a phase void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) { _gc_par_phases[phase]->add(worker_i, secs); } ! void G1GCPhaseTimes::record_or_add_objcopy_time_secs(uint worker_i, double secs) { ! if (_gc_par_phases[ObjCopy]->get(worker_i) == _gc_par_phases[ObjCopy]->uninitialized()) { ! record_time_secs(ObjCopy, worker_i, secs); ! } else { ! add_time_secs(ObjCopy, worker_i, secs); ! } } void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_i, size_t count, uint index) { _gc_par_phases[phase]->set_thread_work_item(worker_i, count, index); }
*** 467,476 **** --- 471,495 ---- if (_cur_verify_after_time_ms > 0.0) { debug_time("Verify After", _cur_verify_after_time_ms); } } + G1EvacPhaseWithTrimTimeTracker::G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time) : + _pss(pss), + _start(Ticks::now()), + _total_time(total_time), + _trim_time(trim_time) { + + assert(_pss->trim_ticks().value() == 0, "Possibly remaining trim ticks left over from previous use"); + } + + G1EvacPhaseWithTrimTimeTracker::~G1EvacPhaseWithTrimTimeTracker() { + _total_time += (Ticks::now() - _start) + _pss->trim_ticks(); + _trim_time += _pss->trim_ticks(); + _pss->reset_trim_ticks(); + } + G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id) : _phase_times(phase_times), _phase(phase), _worker_id(worker_id) { if (_phase_times != NULL) { _start_time = os::elapsedTime(); }
*** 480,484 **** --- 499,520 ---- if (_phase_times != NULL) { _phase_times->record_time_secs(_phase, _worker_id, os::elapsedTime() - _start_time); } } + G1EvacPhaseTimesTracker::G1EvacPhaseTimesTracker(G1GCPhaseTimes* phase_times, + G1ParScanThreadState* pss, + G1GCPhaseTimes::GCParPhases phase, + uint worker_id) : + G1GCParPhaseTimesTracker(phase_times, phase, worker_id), + _total_time(), + _trim_time(), + _trim_tracker(pss, _total_time, _trim_time) { + } + + G1EvacPhaseTimesTracker::~G1EvacPhaseTimesTracker() { + if (_phase_times != NULL) { + _start_time += TicksToTimeHelper::seconds(_trim_time); + _phase_times->record_or_add_objcopy_time_secs(_worker_id, TicksToTimeHelper::seconds(_trim_time)); + } + } +
< prev index next >