8204287: Phase timings not updated correctly after JDK-6672778

Reviewed-by: tschatzl, kbarrett
This commit is contained in:
Stefan Johansson 2018-06-07 09:02:03 +02:00
parent f801eef7d1
commit dce30cad15
2 changed files with 16 additions and 1 deletions

@ -468,15 +468,24 @@ G1EvacPhaseWithTrimTimeTracker::G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadSt
_pss(pss),
_start(Ticks::now()),
_total_time(total_time),
_trim_time(trim_time) {
_trim_time(trim_time),
_stopped(false) {
assert(_pss->trim_ticks().value() == 0, "Possibly remaining trim ticks left over from previous use");
}
G1EvacPhaseWithTrimTimeTracker::~G1EvacPhaseWithTrimTimeTracker() {
if (!_stopped) {
stop();
}
}
void G1EvacPhaseWithTrimTimeTracker::stop() {
assert(!_stopped, "Should only be called once");
_total_time += (Ticks::now() - _start) - _pss->trim_ticks();
_trim_time += _pss->trim_ticks();
_pss->reset_trim_ticks();
_stopped = true;
}
G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id) :
@ -504,6 +513,8 @@ G1EvacPhaseTimesTracker::G1EvacPhaseTimesTracker(G1GCPhaseTimes* phase_times,
G1EvacPhaseTimesTracker::~G1EvacPhaseTimesTracker() {
if (_phase_times != NULL) {
// Explicitly stop the trim tracker since it's not yet destructed.
_trim_tracker.stop();
// Exclude trim time by increasing the start time.
_start_time += _trim_time;
_phase_times->record_or_add_objcopy_time_secs(_worker_id, _trim_time.seconds());

@ -373,9 +373,13 @@ class G1EvacPhaseWithTrimTimeTracker : public StackObj {
Tickspan& _total_time;
Tickspan& _trim_time;
bool _stopped;
public:
G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time);
~G1EvacPhaseWithTrimTimeTracker();
void stop();
};
class G1GCParPhaseTimesTracker : public CHeapObj<mtGC> {