Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
8244226: Shenandoah: per-cycle statistics contain worker data from pr…
Browse files Browse the repository at this point in the history
…evious cycles

Reviewed-by: rkennke
  • Loading branch information
shipilev committed May 1, 2020
1 parent 318fab9 commit da064f8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.cpp
Expand Up @@ -148,9 +148,23 @@ void ShenandoahPhaseTimings::record_phase_time(Phase phase, double time) {
void ShenandoahPhaseTimings::record_workers_start(Phase phase) {
assert(is_worker_phase(phase), "Phase should accept worker phase times: %s", phase_name(phase));

// Special case: these phases can enter multiple times, need to reset
// their worker data every time.
if (phase == heap_iteration_roots) {
for (uint i = 1; i < _num_par_phases; i++) {
worker_data(phase, ParPhase(i))->reset();
}
}

#ifdef ASSERT
for (uint i = 1; i < _num_par_phases; i++) {
worker_data(phase, ParPhase(i))->reset();
ShenandoahWorkerData* wd = worker_data(phase, ParPhase(i));
for (uint c = 0; c < _max_workers; c++) {
assert(wd->get(c) == ShenandoahWorkerData::uninitialized(),
"Should not be set: %s", phase_name(worker_par_phase(phase, ParPhase(i))));
}
}
#endif
}

void ShenandoahPhaseTimings::record_workers_end(Phase phase) {
Expand Down Expand Up @@ -178,6 +192,9 @@ void ShenandoahPhaseTimings::flush_cycle_to_global() {
for (uint i = 0; i < _num_phases; i++) {
_global_data[i].add(_cycle_data[i]);
_cycle_data[i] = 0;
if (_worker_data[i] != NULL) {
_worker_data[i]->reset();
}
}
OrderAccess::fence();
}
Expand Down

0 comments on commit da064f8

Please sign in to comment.