< prev index next > src/hotspot/share/gc/shenandoah/shenandoahCollectorPolicy.cpp
Print this page
/*
* Copyright (c) 2013, 2021, Red Hat, Inc. All rights reserved.
+ * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
_abbreviated_concurrent_gcs(0),
_success_degenerated_gcs(0),
_abbreviated_degenerated_gcs(0),
_success_full_gcs(0),
_consecutive_degenerated_gcs(0),
+ _consecutive_young_gcs(0),
+ _mixed_gcs(0),
+ _success_old_gcs(0),
+ _interrupted_old_gcs(0),
_alloc_failure_degenerated(0),
_alloc_failure_degenerated_upgrade_to_full(0),
_alloc_failure_full(0) {
Copy::zero_to_bytes(_degen_point_counts, sizeof(size_t) * ShenandoahGC::_DEGENERATED_LIMIT);
void ShenandoahCollectorPolicy::record_degenerated_upgrade_to_full() {
_consecutive_degenerated_gcs = 0;
_alloc_failure_degenerated_upgrade_to_full++;
}
! void ShenandoahCollectorPolicy::record_success_concurrent(bool is_abbreviated) {
_consecutive_degenerated_gcs = 0;
_success_concurrent_gcs++;
if (is_abbreviated) {
_abbreviated_concurrent_gcs++;
}
}
! void ShenandoahCollectorPolicy::record_success_degenerated(bool is_abbreviated) {
_success_degenerated_gcs++;
_consecutive_degenerated_gcs++;
if (is_abbreviated) {
_abbreviated_degenerated_gcs++;
}
}
void ShenandoahCollectorPolicy::record_success_full() {
_consecutive_degenerated_gcs = 0;
_success_full_gcs++;
}
void ShenandoahCollectorPolicy::record_shutdown() {
_in_shutdown.set();
void ShenandoahCollectorPolicy::record_degenerated_upgrade_to_full() {
_consecutive_degenerated_gcs = 0;
_alloc_failure_degenerated_upgrade_to_full++;
}
! void ShenandoahCollectorPolicy::record_success_concurrent(bool is_young, bool is_abbreviated) {
+ update_young(is_young);
+
_consecutive_degenerated_gcs = 0;
_success_concurrent_gcs++;
if (is_abbreviated) {
_abbreviated_concurrent_gcs++;
}
}
! void ShenandoahCollectorPolicy::record_mixed_cycle() {
+ _mixed_gcs++;
+ }
+
+ void ShenandoahCollectorPolicy::record_success_old() {
+ _consecutive_young_gcs = 0;
+ _success_old_gcs++;
+ }
+
+ void ShenandoahCollectorPolicy::record_interrupted_old() {
+ _consecutive_young_gcs = 0;
+ _interrupted_old_gcs++;
+ }
+
+ void ShenandoahCollectorPolicy::record_success_degenerated(bool is_young, bool is_abbreviated) {
+ update_young(is_young);
+
_success_degenerated_gcs++;
_consecutive_degenerated_gcs++;
if (is_abbreviated) {
_abbreviated_degenerated_gcs++;
}
}
+ void ShenandoahCollectorPolicy::update_young(bool is_young) {
+ if (is_young) {
+ _consecutive_young_gcs++;
+ } else {
+ _consecutive_young_gcs = 0;
+ }
+ }
+
void ShenandoahCollectorPolicy::record_success_full() {
_consecutive_degenerated_gcs = 0;
+ _consecutive_young_gcs = 0;
_success_full_gcs++;
}
void ShenandoahCollectorPolicy::record_shutdown() {
_in_shutdown.set();
return GCCause::is_user_requested_gc(cause)
|| GCCause::is_serviceability_requested_gc(cause);
}
bool is_implicit_gc(GCCause::Cause cause) {
! return cause != GCCause::_allocation_failure
&& cause != GCCause::_shenandoah_concurrent_gc
&& !is_explicit_gc(cause);
}
#ifdef ASSERT
bool is_valid_request(GCCause::Cause cause) {
return GCCause::is_user_requested_gc(cause)
|| GCCause::is_serviceability_requested_gc(cause);
}
bool is_implicit_gc(GCCause::Cause cause) {
! return cause != GCCause::_no_gc
&& cause != GCCause::_shenandoah_concurrent_gc
+ && cause != GCCause::_allocation_failure
&& !is_explicit_gc(cause);
}
#ifdef ASSERT
bool is_valid_request(GCCause::Cause cause) {
|| cause == GCCause::_wb_breakpoint
|| cause == GCCause::_scavenge_alot;
}
#endif
+ bool ShenandoahCollectorPolicy::is_requested_gc(GCCause::Cause cause) {
+ return is_explicit_gc(cause) || is_implicit_gc(cause);
+ }
+
bool ShenandoahCollectorPolicy::should_run_full_gc(GCCause::Cause cause) {
return is_explicit_gc(cause) ? !ExplicitGCInvokesConcurrent : !ShenandoahImplicitGCInvokesConcurrent;
}
bool ShenandoahCollectorPolicy::should_handle_requested_gc(GCCause::Cause cause) {
out->print_cr("tune GC heuristics, set more aggressive pacing delay, or lower allocation rate");
out->print_cr("to avoid Degenerated and Full GC cycles. Abbreviated cycles are those which found");
out->print_cr("enough regions with no live objects to skip evacuation.");
out->cr();
! size_t completed_gcs = _success_full_gcs + _success_degenerated_gcs + _success_concurrent_gcs;
out->print_cr(SIZE_FORMAT_W(5) " Completed GCs", completed_gcs);
size_t explicit_requests = 0;
size_t implicit_requests = 0;
for (int c = 0; c < GCCause::_last_gc_cause; c++) {
out->print_cr("tune GC heuristics, set more aggressive pacing delay, or lower allocation rate");
out->print_cr("to avoid Degenerated and Full GC cycles. Abbreviated cycles are those which found");
out->print_cr("enough regions with no live objects to skip evacuation.");
out->cr();
! size_t completed_gcs = _success_full_gcs + _success_degenerated_gcs + _success_concurrent_gcs + _success_old_gcs;
out->print_cr(SIZE_FORMAT_W(5) " Completed GCs", completed_gcs);
size_t explicit_requests = 0;
size_t implicit_requests = 0;
for (int c = 0; c < GCCause::_last_gc_cause; c++) {
out->print_cr(" " SIZE_FORMAT_W(5) " invoked implicitly (%.2f%%)", implicit_requests, percent_of(implicit_requests, _success_concurrent_gcs));
}
out->print_cr(" " SIZE_FORMAT_W(5) " abbreviated (%.2f%%)", _abbreviated_concurrent_gcs, percent_of(_abbreviated_concurrent_gcs, _success_concurrent_gcs));
out->cr();
+ if (ShenandoahHeap::heap()->mode()->is_generational()) {
+ out->print_cr(SIZE_FORMAT_W(5) " Completed Old GCs (%.2f%%)", _success_old_gcs, percent_of(_success_old_gcs, completed_gcs));
+ out->print_cr(" " SIZE_FORMAT_W(5) " mixed", _mixed_gcs);
+ out->print_cr(" " SIZE_FORMAT_W(5) " interruptions", _interrupted_old_gcs);
+ out->cr();
+ }
+
size_t degenerated_gcs = _alloc_failure_degenerated_upgrade_to_full + _success_degenerated_gcs;
out->print_cr(SIZE_FORMAT_W(5) " Degenerated GCs (%.2f%%)", degenerated_gcs, percent_of(degenerated_gcs, completed_gcs));
out->print_cr(" " SIZE_FORMAT_W(5) " upgraded to Full GC (%.2f%%)", _alloc_failure_degenerated_upgrade_to_full, percent_of(_alloc_failure_degenerated_upgrade_to_full, degenerated_gcs));
out->print_cr(" " SIZE_FORMAT_W(5) " caused by allocation failure (%.2f%%)", _alloc_failure_degenerated, percent_of(_alloc_failure_degenerated, degenerated_gcs));
out->print_cr(" " SIZE_FORMAT_W(5) " abbreviated (%.2f%%)", _abbreviated_degenerated_gcs, percent_of(_abbreviated_degenerated_gcs, degenerated_gcs));
< prev index next >