Skip to content

Commit

Permalink
Log heuristics decisions at info with ergo tag
Browse files Browse the repository at this point in the history
  • Loading branch information
earthling-amzn committed Nov 15, 2024
1 parent f02d024 commit 14a9186
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool ShenandoahOldHeuristics::prime_collection_set(ShenandoahCollectionSet* coll
// We have unprocessed old collection candidates, but the heuristic has given up on evacuating them.
// This is most likely because they were _all_ pinned at the time of the last mixed evacuation (and
// this in turn is most likely because there are just one or two candidate regions remaining).
log_debug(gc)("Remaining " UINT32_FORMAT " old regions are being coalesced and filled", unprocessed_old_collection_candidates());
log_info(gc, ergo)("Remaining " UINT32_FORMAT " old regions are being coalesced and filled", unprocessed_old_collection_candidates());
return false;
}

Expand Down Expand Up @@ -209,10 +209,8 @@ bool ShenandoahOldHeuristics::prime_collection_set(ShenandoahCollectionSet* coll
}
decrease_unprocessed_old_collection_candidates_live_memory(evacuated_old_bytes);
if (included_old_regions > 0) {
log_debug(gc)("Old-gen piggyback evac (" UINT32_FORMAT " regions, evacuating " SIZE_FORMAT "%s, reclaiming: " SIZE_FORMAT "%s)",
included_old_regions,
byte_size_in_proper_unit(evacuated_old_bytes), proper_unit_for_byte_size(evacuated_old_bytes),
byte_size_in_proper_unit(collected_old_bytes), proper_unit_for_byte_size(collected_old_bytes));
log_info(gc, ergo)("Old-gen piggyback evac (" UINT32_FORMAT " regions, evacuating " PROPERFMT ", reclaiming: " PROPERFMT ")",
included_old_regions, PROPERFMTARGS(evacuated_old_bytes), PROPERFMTARGS(collected_old_bytes));
}

if (unprocessed_old_collection_candidates() == 0) {
Expand All @@ -228,17 +226,17 @@ bool ShenandoahOldHeuristics::prime_collection_set(ShenandoahCollectionSet* coll
// if they are all pinned we transition to a state that will allow us to make these uncollected
// (pinned) regions parsable.
if (all_candidates_are_pinned()) {
log_debug(gc)("All candidate regions " UINT32_FORMAT " are pinned", unprocessed_old_collection_candidates());
log_info(gc, ergo)("All candidate regions " UINT32_FORMAT " are pinned", unprocessed_old_collection_candidates());
_old_generation->abandon_mixed_evacuations();
} else {
log_debug(gc)("No regions selected for mixed collection. "
"Old evacuation budget: " PROPERFMT ", Remaining evacuation budget: " PROPERFMT
", Lost capacity: " PROPERFMT
", Next candidate: " UINT32_FORMAT ", Last candidate: " UINT32_FORMAT,
PROPERFMTARGS(old_evacuation_reserve),
PROPERFMTARGS(remaining_old_evacuation_budget),
PROPERFMTARGS(lost_evacuation_capacity),
_next_old_collection_candidate, _last_old_collection_candidate);
log_info(gc, ergo)("No regions selected for mixed collection. "
"Old evacuation budget: " PROPERFMT ", Remaining evacuation budget: " PROPERFMT
", Lost capacity: " PROPERFMT
", Next candidate: " UINT32_FORMAT ", Last candidate: " UINT32_FORMAT,
PROPERFMTARGS(old_evacuation_reserve),
PROPERFMTARGS(remaining_old_evacuation_budget),
PROPERFMTARGS(lost_evacuation_capacity),
_next_old_collection_candidate, _last_old_collection_candidate);
}
}

Expand Down Expand Up @@ -468,12 +466,12 @@ void ShenandoahOldHeuristics::prepare_for_old_collections() {
const size_t mixed_evac_live = old_candidates * region_size_bytes - (candidates_garbage + unfragmented);
set_unprocessed_old_collection_candidates_live_memory(mixed_evac_live);

log_debug(gc)("Old-Gen Collectable Garbage: " PROPERFMT " consolidated with free: " PROPERFMT ", over " SIZE_FORMAT " regions",
PROPERFMTARGS(collectable_garbage), PROPERFMTARGS(unfragmented), old_candidates);
log_debug(gc)("Old-Gen Immediate Garbage: " PROPERFMT " over " SIZE_FORMAT " regions",
PROPERFMTARGS(immediate_garbage), immediate_regions);
log_debug(gc)("Old regions selected for defragmentation: " SIZE_FORMAT, defrag_count);
log_debug(gc)("Old regions not selected: " SIZE_FORMAT, total_uncollected_old_regions);
log_info(gc, ergo)("Old-Gen Collectable Garbage: " PROPERFMT " consolidated with free: " PROPERFMT ", over " SIZE_FORMAT " regions",
PROPERFMTARGS(collectable_garbage), PROPERFMTARGS(unfragmented), old_candidates);
log_info(gc, ergo)("Old-Gen Immediate Garbage: " PROPERFMT " over " SIZE_FORMAT " regions",
PROPERFMTARGS(immediate_garbage), immediate_regions);
log_info(gc, ergo)("Old regions selected for defragmentation: " SIZE_FORMAT, defrag_count);
log_info(gc, ergo)("Old regions not selected: " SIZE_FORMAT, total_uncollected_old_regions);

if (unprocessed_old_collection_candidates() > 0) {
_old_generation->transition_to(ShenandoahOldGeneration::EVACUATING);
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1607,12 +1607,12 @@ void ShenandoahFreeSet::establish_generation_sizes(size_t young_region_count, si

if (new_old_capacity > original_old_capacity) {
size_t region_count = (new_old_capacity - original_old_capacity) / region_size_bytes;
log_debug(gc)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT,
region_count, young_gen->name(), old_gen->name(), PROPERFMTARGS(new_old_capacity));
log_info(gc, ergo)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT,
region_count, young_gen->name(), old_gen->name(), PROPERFMTARGS(new_old_capacity));
} else if (new_old_capacity < original_old_capacity) {
size_t region_count = (original_old_capacity - new_old_capacity) / region_size_bytes;
log_debug(gc)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT,
region_count, old_gen->name(), young_gen->name(), PROPERFMTARGS(new_young_capacity));
log_info(gc, ergo)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT,
region_count, old_gen->name(), young_gen->name(), PROPERFMTARGS(new_young_capacity));
}
// This balances generations, so clear any pending request to balance.
old_gen->set_region_balance(0);
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/shenandoah/shenandoahGenerationSizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ bool ShenandoahGenerationSizer::transfer_regions(ShenandoahGeneration* src, Shen
src->decrease_capacity(bytes_to_transfer);
dst->increase_capacity(bytes_to_transfer);
const size_t new_size = dst->max_capacity();
log_debug(gc)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT,
regions, src->name(), dst->name(), PROPERFMTARGS(new_size));
log_info(gc, ergo)("Transfer " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT,
regions, src->name(), dst->name(), PROPERFMTARGS(new_size));
return true;
}

Expand Down Expand Up @@ -190,8 +190,8 @@ void ShenandoahGenerationSizer::force_transfer_to_old(size_t regions) const {
young_gen->decrease_capacity(bytes_to_transfer);
old_gen->increase_capacity(bytes_to_transfer);
const size_t new_size = old_gen->max_capacity();
log_debug(gc)("Forcing transfer of " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT,
regions, young_gen->name(), old_gen->name(), PROPERFMTARGS(new_size));
log_info(gc, ergo)("Forcing transfer of " SIZE_FORMAT " region(s) from %s to %s, yielding increased size: " PROPERFMT,
regions, young_gen->name(), old_gen->name(), PROPERFMTARGS(new_size));
}


Expand Down

0 comments on commit 14a9186

Please sign in to comment.