Skip to content

Commit

Permalink
Fixed for assertion failure due to not checking if we are processing …
Browse files Browse the repository at this point in the history
…Eph samples (#105164)
  • Loading branch information
mrsharm authored Jul 25, 2024
1 parent f060387 commit 034e8ee
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25402,17 +25402,21 @@ void gc_heap::calculate_new_heap_count ()
// If there was a blocking gen2 GC, the overhead would be very large and most likely we would not pick it. So we
// rely on the gen2 sample's overhead calculated above.
float throughput_cost_percents[dynamic_heap_count_data_t::sample_size];
for (int i = 0; i < dynamic_heap_count_data_t::sample_size; i++)
{
dynamic_heap_count_data_t::sample& sample = dynamic_heap_count_data.samples[i];
assert (sample.elapsed_between_gcs > 0);
throughput_cost_percents[i] = (sample.elapsed_between_gcs ? (((float)sample.msl_wait_time / n_heaps + sample.gc_pause_time) * 100.0f / (float)sample.elapsed_between_gcs) : 0.0f);
assert (throughput_cost_percents[i] >= 0.0);
if (throughput_cost_percents[i] > 100.0)
throughput_cost_percents[i] = 100.0;
dprintf (6666, ("sample %d in GC#%Id msl %I64d / %d + pause %I64d / elapsed %I64d = tcp: %.3f, surv %zd, gc speed %zd/ms", i,
sample.gc_index, sample.msl_wait_time, n_heaps, sample.gc_pause_time, sample.elapsed_between_gcs, throughput_cost_percents[i],
sample.gc_survived_size, (sample.gc_pause_time ? (sample.gc_survived_size * 1000 / sample.gc_pause_time) : 0)));

if (process_eph_samples_p)
{
for (int i = 0; i < dynamic_heap_count_data_t::sample_size; i++)
{
dynamic_heap_count_data_t::sample& sample = dynamic_heap_count_data.samples[i];
assert (sample.elapsed_between_gcs > 0);
throughput_cost_percents[i] = (sample.elapsed_between_gcs ? (((float)sample.msl_wait_time / n_heaps + sample.gc_pause_time) * 100.0f / (float)sample.elapsed_between_gcs) : 0.0f);
assert (throughput_cost_percents[i] >= 0.0);
if (throughput_cost_percents[i] > 100.0)
throughput_cost_percents[i] = 100.0;
dprintf (6666, ("sample %d in GC#%Id msl %I64d / %d + pause %I64d / elapsed %I64d = tcp: %.3f, surv %zd, gc speed %zd/ms", i,
sample.gc_index, sample.msl_wait_time, n_heaps, sample.gc_pause_time, sample.elapsed_between_gcs, throughput_cost_percents[i],
sample.gc_survived_size, (sample.gc_pause_time ? (sample.gc_survived_size * 1000 / sample.gc_pause_time) : 0)));
}
}

float median_throughput_cost_percent = median_of_3 (throughput_cost_percents[0], throughput_cost_percents[1], throughput_cost_percents[2]);
Expand Down

0 comments on commit 034e8ee

Please sign in to comment.