8225216: gc/logging/TestMetaSpaceLog.java doesn't work for Shenandoah

Reviewed-by: shade
This commit is contained in:
Kelvin Nilsen 2020-03-12 06:47:17 +01:00 committed by Aleksey Shipilev
parent b0f32c4431
commit 19e02810db
3 changed files with 23 additions and 21 deletions

View file

@ -178,6 +178,9 @@ void ShenandoahControlThread::run_service() {
if (gc_requested) { if (gc_requested) {
heap->reset_bytes_allocated_since_gc_start(); heap->reset_bytes_allocated_since_gc_start();
// Use default constructor to snapshot the Metaspace state before GC.
metaspace::MetaspaceSizesSnapshot meta_sizes;
// If GC was requested, we are sampling the counters even without actual triggers // If GC was requested, we are sampling the counters even without actual triggers
// from allocation machinery. This captures GC phases more accurately. // from allocation machinery. This captures GC phases more accurately.
set_forced_counters_update(true); set_forced_counters_update(true);
@ -187,11 +190,8 @@ void ShenandoahControlThread::run_service() {
ShenandoahHeapLocker locker(heap->lock()); ShenandoahHeapLocker locker(heap->lock());
heap->free_set()->log_status(); heap->free_set()->log_status();
} }
}
switch (mode) { switch (mode) {
case none:
break;
case concurrent_traversal: case concurrent_traversal:
service_concurrent_traversal_cycle(cause); service_concurrent_traversal_cycle(cause);
break; break;
@ -208,7 +208,6 @@ void ShenandoahControlThread::run_service() {
ShouldNotReachHere(); ShouldNotReachHere();
} }
if (gc_requested) {
// If this was the requested GC cycle, notify waiters about it // If this was the requested GC cycle, notify waiters about it
if (explicit_gc_requested || implicit_gc_requested) { if (explicit_gc_requested || implicit_gc_requested) {
notify_gc_waiters(); notify_gc_waiters();
@ -244,6 +243,9 @@ void ShenandoahControlThread::run_service() {
heuristics->clear_metaspace_oom(); heuristics->clear_metaspace_oom();
} }
// Print Metaspace change following GC (if logging is enabled).
MetaspaceUtils::print_metaspace_change(meta_sizes);
// GC is over, we are at idle now // GC is over, we are at idle now
if (ShenandoahPacing) { if (ShenandoahPacing) {
heap->pacer()->setup_for_idle(); heap->pacer()->setup_for_idle();

View file

@ -242,6 +242,7 @@ tier2_gc_shenandoah = \
gc/ergonomics/TestInitialGCThreadLogging.java \ gc/ergonomics/TestInitialGCThreadLogging.java \
gc/ergonomics/TestDynamicNumberOfGCThreads.java \ gc/ergonomics/TestDynamicNumberOfGCThreads.java \
gc/logging/TestGCId.java \ gc/logging/TestGCId.java \
gc/logging/TestMetaSpaceLog.java \
gc/metaspace/TestMetaspacePerfCounters.java \ gc/metaspace/TestMetaspacePerfCounters.java \
gc/metaspace/TestMetaspacePerfCounters.java \ gc/metaspace/TestMetaspacePerfCounters.java \
gc/startup_warnings/TestShenandoah.java \ gc/startup_warnings/TestShenandoah.java \

View file

@ -45,7 +45,6 @@ import sun.hotspot.WhiteBox;
* java.management * java.management
* @requires vm.gc != "Epsilon" * @requires vm.gc != "Epsilon"
* @requires vm.gc != "Z" * @requires vm.gc != "Z"
* @requires vm.gc != "Shenandoah"
* *
* @compile TestMetaSpaceLog.java * @compile TestMetaSpaceLog.java
* @run driver ClassFileInstaller sun.hotspot.WhiteBox * @run driver ClassFileInstaller sun.hotspot.WhiteBox