Skip to content

Commit

Permalink
8225216: gc/logging/TestMetaSpaceLog.java doesn't work for Shenandoah
Browse files Browse the repository at this point in the history
Reviewed-by: shade
  • Loading branch information
kdnilsen authored and shipilev committed Mar 12, 2020
1 parent b0f32c4 commit 19e0281
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
42 changes: 22 additions & 20 deletions src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ void ShenandoahControlThread::run_service() {
if (gc_requested) {
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
// from allocation machinery. This captures GC phases more accurately.
set_forced_counters_update(true);
Expand All @@ -187,28 +190,24 @@ void ShenandoahControlThread::run_service() {
ShenandoahHeapLocker locker(heap->lock());
heap->free_set()->log_status();
}
}

switch (mode) {
case none:
break;
case concurrent_traversal:
service_concurrent_traversal_cycle(cause);
break;
case concurrent_normal:
service_concurrent_normal_cycle(cause);
break;
case stw_degenerated:
service_stw_degenerated_cycle(cause, degen_point);
break;
case stw_full:
service_stw_full_cycle(cause);
break;
default:
ShouldNotReachHere();
}
switch (mode) {
case concurrent_traversal:
service_concurrent_traversal_cycle(cause);
break;
case concurrent_normal:
service_concurrent_normal_cycle(cause);
break;
case stw_degenerated:
service_stw_degenerated_cycle(cause, degen_point);
break;
case stw_full:
service_stw_full_cycle(cause);
break;
default:
ShouldNotReachHere();
}

if (gc_requested) {
// If this was the requested GC cycle, notify waiters about it
if (explicit_gc_requested || implicit_gc_requested) {
notify_gc_waiters();
Expand Down Expand Up @@ -244,6 +243,9 @@ void ShenandoahControlThread::run_service() {
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
if (ShenandoahPacing) {
heap->pacer()->setup_for_idle();
Expand Down
1 change: 1 addition & 0 deletions test/hotspot/jtreg/TEST.groups
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ tier2_gc_shenandoah = \
gc/ergonomics/TestInitialGCThreadLogging.java \
gc/ergonomics/TestDynamicNumberOfGCThreads.java \
gc/logging/TestGCId.java \
gc/logging/TestMetaSpaceLog.java \
gc/metaspace/TestMetaspacePerfCounters.java \
gc/metaspace/TestMetaspacePerfCounters.java \
gc/startup_warnings/TestShenandoah.java \
Expand Down
1 change: 0 additions & 1 deletion test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
* java.management
* @requires vm.gc != "Epsilon"
* @requires vm.gc != "Z"
* @requires vm.gc != "Shenandoah"
*
* @compile TestMetaSpaceLog.java
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
Expand Down

0 comments on commit 19e0281

Please sign in to comment.