Skip to content

Commit 034e8ee

Browse files
authored
Fixed for assertion failure due to not checking if we are processing Eph samples (#105164)
1 parent f060387 commit 034e8ee

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25402,17 +25402,21 @@ void gc_heap::calculate_new_heap_count ()
2540225402
// If there was a blocking gen2 GC, the overhead would be very large and most likely we would not pick it. So we
2540325403
// rely on the gen2 sample's overhead calculated above.
2540425404
float throughput_cost_percents[dynamic_heap_count_data_t::sample_size];
25405-
for (int i = 0; i < dynamic_heap_count_data_t::sample_size; i++)
25406-
{
25407-
dynamic_heap_count_data_t::sample& sample = dynamic_heap_count_data.samples[i];
25408-
assert (sample.elapsed_between_gcs > 0);
25409-
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);
25410-
assert (throughput_cost_percents[i] >= 0.0);
25411-
if (throughput_cost_percents[i] > 100.0)
25412-
throughput_cost_percents[i] = 100.0;
25413-
dprintf (6666, ("sample %d in GC#%Id msl %I64d / %d + pause %I64d / elapsed %I64d = tcp: %.3f, surv %zd, gc speed %zd/ms", i,
25414-
sample.gc_index, sample.msl_wait_time, n_heaps, sample.gc_pause_time, sample.elapsed_between_gcs, throughput_cost_percents[i],
25415-
sample.gc_survived_size, (sample.gc_pause_time ? (sample.gc_survived_size * 1000 / sample.gc_pause_time) : 0)));
25405+
25406+
if (process_eph_samples_p)
25407+
{
25408+
for (int i = 0; i < dynamic_heap_count_data_t::sample_size; i++)
25409+
{
25410+
dynamic_heap_count_data_t::sample& sample = dynamic_heap_count_data.samples[i];
25411+
assert (sample.elapsed_between_gcs > 0);
25412+
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);
25413+
assert (throughput_cost_percents[i] >= 0.0);
25414+
if (throughput_cost_percents[i] > 100.0)
25415+
throughput_cost_percents[i] = 100.0;
25416+
dprintf (6666, ("sample %d in GC#%Id msl %I64d / %d + pause %I64d / elapsed %I64d = tcp: %.3f, surv %zd, gc speed %zd/ms", i,
25417+
sample.gc_index, sample.msl_wait_time, n_heaps, sample.gc_pause_time, sample.elapsed_between_gcs, throughput_cost_percents[i],
25418+
sample.gc_survived_size, (sample.gc_pause_time ? (sample.gc_survived_size * 1000 / sample.gc_pause_time) : 0)));
25419+
}
2541625420
}
2541725421

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

0 commit comments

Comments
 (0)