8244326: Shenandoah: global statistics should not accept bogus samples
Reviewed-by: rkennke
This commit is contained in:
parent
81597d9f8f
commit
00e15ff4e6
@ -57,7 +57,7 @@ ShenandoahPhaseTimings::ShenandoahPhaseTimings(uint max_workers) :
|
|||||||
_worker_data[i] = NULL;
|
_worker_data[i] = NULL;
|
||||||
SHENANDOAH_PAR_PHASE_DO(,, SHENANDOAH_WORKER_DATA_NULL)
|
SHENANDOAH_PAR_PHASE_DO(,, SHENANDOAH_WORKER_DATA_NULL)
|
||||||
#undef SHENANDOAH_WORKER_DATA_NULL
|
#undef SHENANDOAH_WORKER_DATA_NULL
|
||||||
_cycle_data[i] = 0;
|
_cycle_data[i] = uninitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then punch in the worker-related data.
|
// Then punch in the worker-related data.
|
||||||
@ -134,7 +134,7 @@ bool ShenandoahPhaseTimings::is_root_work_phase(Phase phase) {
|
|||||||
void ShenandoahPhaseTimings::set_cycle_data(Phase phase, double time) {
|
void ShenandoahPhaseTimings::set_cycle_data(Phase phase, double time) {
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
double d = _cycle_data[phase];
|
double d = _cycle_data[phase];
|
||||||
assert(d == 0, "Should not be set yet: %s, current value: %lf", phase_name(phase), d);
|
assert(d == uninitialized(), "Should not be set yet: %s, current value: %lf", phase_name(phase), d);
|
||||||
#endif
|
#endif
|
||||||
_cycle_data[phase] = time;
|
_cycle_data[phase] = time;
|
||||||
}
|
}
|
||||||
@ -175,23 +175,44 @@ void ShenandoahPhaseTimings::flush_par_workers_to_cycle() {
|
|||||||
for (uint pi = 0; pi < _num_phases; pi++) {
|
for (uint pi = 0; pi < _num_phases; pi++) {
|
||||||
Phase phase = Phase(pi);
|
Phase phase = Phase(pi);
|
||||||
if (is_worker_phase(phase)) {
|
if (is_worker_phase(phase)) {
|
||||||
double s = 0;
|
double s = uninitialized();
|
||||||
for (uint i = 1; i < _num_par_phases; i++) {
|
for (uint i = 1; i < _num_par_phases; i++) {
|
||||||
double t = worker_data(phase, ParPhase(i))->sum();
|
ShenandoahWorkerData* wd = worker_data(phase, ParPhase(i));
|
||||||
// add to each line in phase
|
double ws = uninitialized();
|
||||||
set_cycle_data(Phase(phase + i + 1), t);
|
for (uint c = 0; c < _max_workers; c++) {
|
||||||
s += t;
|
double v = wd->get(c);
|
||||||
|
if (v != ShenandoahWorkerData::uninitialized()) {
|
||||||
|
if (ws == uninitialized()) {
|
||||||
|
ws = v;
|
||||||
|
} else {
|
||||||
|
ws += v;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ws != uninitialized()) {
|
||||||
|
// add to each line in phase
|
||||||
|
set_cycle_data(Phase(phase + i + 1), ws);
|
||||||
|
if (s == uninitialized()) {
|
||||||
|
s = ws;
|
||||||
|
} else {
|
||||||
|
s += ws;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (s != uninitialized()) {
|
||||||
// add to total for phase
|
// add to total for phase
|
||||||
set_cycle_data(Phase(phase + 1), s);
|
set_cycle_data(Phase(phase + 1), s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ShenandoahPhaseTimings::flush_cycle_to_global() {
|
void ShenandoahPhaseTimings::flush_cycle_to_global() {
|
||||||
for (uint i = 0; i < _num_phases; i++) {
|
for (uint i = 0; i < _num_phases; i++) {
|
||||||
|
if (_cycle_data[i] != uninitialized()) {
|
||||||
_global_data[i].add(_cycle_data[i]);
|
_global_data[i].add(_cycle_data[i]);
|
||||||
_cycle_data[i] = 0;
|
_cycle_data[i] = uninitialized();
|
||||||
|
}
|
||||||
if (_worker_data[i] != NULL) {
|
if (_worker_data[i] != NULL) {
|
||||||
_worker_data[i]->reset();
|
_worker_data[i]->reset();
|
||||||
}
|
}
|
||||||
|
@ -195,6 +195,7 @@ private:
|
|||||||
Phase worker_par_phase(Phase phase, ParPhase par_phase);
|
Phase worker_par_phase(Phase phase, ParPhase par_phase);
|
||||||
|
|
||||||
void set_cycle_data(Phase phase, double time);
|
void set_cycle_data(Phase phase, double time);
|
||||||
|
static double uninitialized() { return -1; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ShenandoahPhaseTimings(uint _max_workers);
|
ShenandoahPhaseTimings(uint _max_workers);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user