Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,11 @@ void ShenandoahControlThread::run_service() {
if (ShenandoahPacing) {
heap->pacer()->print_cycle_on(&ls);
}
#ifdef NOT_PRODUCT
ShenandoahEvacuationTracker* evac_tracker = heap->evac_tracker();
ShenandoahCycleStats evac_stats = evac_tracker->flush_cycle_to_global();
evac_tracker->print_evacuations_on(&ls, &evac_stats.workers,
&evac_stats.mutators);
#endif
if (ShenandoahEvacTracking) {
ShenandoahEvacuationTracker* evac_tracker = heap->evac_tracker();
ShenandoahCycleStats evac_stats = evac_tracker->flush_cycle_to_global();
evac_tracker->print_evacuations_on(&ls, &evac_stats.workers, &evac_stats.mutators);
}
}
}

Expand Down
39 changes: 22 additions & 17 deletions src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ void ShenandoahEvacuationStats::ShenandoahEvacuations::print_on(outputStream* st

void ShenandoahEvacuationStats::print_on(outputStream* st) const {
st->print("Young: "); _young.print_on(st);
st->print("Promotion: "); _promotion.print_on(st);
st->print("Old: "); _old.print_on(st);
if (ShenandoahHeap::heap()->mode()->is_generational()) {
st->print("Promotion: "); _promotion.print_on(st);
st->print("Old: "); _old.print_on(st);
}

if (_use_age_table) {
_age_table->print_on(st);
Expand All @@ -123,25 +125,28 @@ void ShenandoahEvacuationTracker::print_global_on(outputStream* st) {
void ShenandoahEvacuationTracker::print_evacuations_on(outputStream* st,
ShenandoahEvacuationStats* workers,
ShenandoahEvacuationStats* mutators) {
st->print_cr("Workers: ");
workers->print_on(st);
st->cr();
st->print_cr("Mutators: ");
mutators->print_on(st);
st->cr();
if (ShenandoahEvacTracking) {
st->print_cr("Workers: ");
workers->print_on(st);
st->cr();
st->print_cr("Mutators: ");
mutators->print_on(st);
st->cr();
}

ShenandoahHeap* heap = ShenandoahHeap::heap();

AgeTable young_region_ages(false);
for (uint i = 0; i < heap->num_regions(); ++i) {
ShenandoahHeapRegion* r = heap->get_region(i);
if (r->is_young()) {
young_region_ages.add(r->age(), r->get_live_data_words());
if (heap->mode()->is_generational()) {
AgeTable young_region_ages(false);
for (uint i = 0; i < heap->num_regions(); ++i) {
ShenandoahHeapRegion* r = heap->get_region(i);
if (r->is_young()) {
young_region_ages.add(r->age(), r->get_live_data_words());
}
}
st->print("Young regions: ");
young_region_ages.print_on(st);
st->cr();
}
st->print("Young regions: ");
young_region_ages.print_on(st);
st->cr();
}

class ShenandoahStatAggregator : public ThreadClosure {
Expand Down
11 changes: 8 additions & 3 deletions src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,11 @@ oop ShenandoahGenerationalHeap::try_evacuate_object(oop p, Thread* thread, Shena
return ShenandoahBarrierSet::resolve_forwarded(p);
}

if (ShenandoahEvacTracking) {
evac_tracker()->begin_evacuation(thread, size * HeapWordSize, from_region->affiliation(), target_gen);
}

// Copy the object:
NOT_PRODUCT(evac_tracker()->begin_evacuation(thread, size * HeapWordSize, from_region->affiliation(), target_gen));
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(p), copy, size);
oop copy_val = cast_to_oop(copy);

Expand All @@ -346,8 +349,10 @@ oop ShenandoahGenerationalHeap::try_evacuate_object(oop p, Thread* thread, Shena
// safe to do this on the public copy (this is also done during concurrent mark).
ContinuationGCSupport::relativize_stack_chunk(copy_val);

// Record that the evacuation succeeded
NOT_PRODUCT(evac_tracker()->end_evacuation(thread, size * HeapWordSize, from_region->affiliation(), target_gen));
if (ShenandoahEvacTracking) {
// Record that the evacuation succeeded
evac_tracker()->end_evacuation(thread, size * HeapWordSize, from_region->affiliation(), target_gen);
}

if (target_gen == OLD_GENERATION) {
old_generation()->handle_evacuation(copy, size, from_region->is_young());
Expand Down
20 changes: 12 additions & 8 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1395,8 +1395,11 @@ oop ShenandoahHeap::try_evacuate_object(oop p, Thread* thread, ShenandoahHeapReg
return ShenandoahBarrierSet::resolve_forwarded(p);
}

if (ShenandoahEvacTracking) {
evac_tracker()->begin_evacuation(thread, size * HeapWordSize, from_region->affiliation(), target_gen);
}

// Copy the object:
NOT_PRODUCT(evac_tracker()->begin_evacuation(thread, size * HeapWordSize, from_region->affiliation(), target_gen));
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(p), copy, size);

// Try to install the new forwarding pointer.
Expand All @@ -1406,7 +1409,9 @@ oop ShenandoahHeap::try_evacuate_object(oop p, Thread* thread, ShenandoahHeapReg
// Successfully evacuated. Our copy is now the public one!
ContinuationGCSupport::relativize_stack_chunk(copy_val);
shenandoah_assert_correct(nullptr, copy_val);
NOT_PRODUCT(evac_tracker()->end_evacuation(thread, size * HeapWordSize, from_region->affiliation(), target_gen));
if (ShenandoahEvacTracking) {
evac_tracker()->end_evacuation(thread, size * HeapWordSize, from_region->affiliation(), target_gen);
}
return copy_val;
} else {
// Failed to evacuate. We need to deal with the object that is left behind. Since this
Expand Down Expand Up @@ -1636,12 +1641,11 @@ void ShenandoahHeap::print_tracing_info() const {
ResourceMark rm;
LogStream ls(lt);

#ifdef NOT_PRODUCT
evac_tracker()->print_global_on(&ls);

ls.cr();
ls.cr();
#endif
if (ShenandoahEvacTracking) {
evac_tracker()->print_global_on(&ls);
ls.cr();
ls.cr();
}

phase_timings()->print_global_on(&ls);

Expand Down
7 changes: 7 additions & 0 deletions src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,13 @@
"events.") \
range(0,100) \
\
product(bool, ShenandoahEvacTracking, false, DIAGNOSTIC, \
"Collect additional metrics about evacuations. Enabling this " \
"tracks how many objects and how many bytes were evacuated, and " \
"how many were abandoned. The information will be categorized " \
"by thread type (worker or mutator) and evacuation type (young, " \
"old, or promotion.") \
\
product(uintx, ShenandoahMinYoungPercentage, 20, EXPERIMENTAL, \
"The minimum percentage of the heap to use for the young " \
"generation. Heuristics will not adjust the young generation " \
Expand Down