< prev index next > test/hotspot/jtreg/gc/shenandoah/mxbeans/TestChurnNotifications.java
Print this page
/*
* Copyright (c) 2018, 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.
/*
* @test id=passive
* @summary Check that MX notifications are reported for all cycles
* @library /test/lib /
- * @requires vm.gc.Shenandoah
+ * @requires vm.gc.Shenandoah & vm.opt.ShenandoahGCMode != "generational"
*
* @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
* -XX:+ShenandoahDegeneratedGC -Dprecise=true
* TestChurnNotifications
/*
* @test id=aggressive
* @summary Check that MX notifications are reported for all cycles
* @library /test/lib /
- * @requires vm.gc.Shenandoah
+ * @requires vm.gc.Shenandoah & vm.opt.ShenandoahGCMode != "generational"
*
* @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
* -Dprecise=false
* TestChurnNotifications
/*
* @test id=adaptive
* @summary Check that MX notifications are reported for all cycles
* @library /test/lib /
- * @requires vm.gc.Shenandoah
+ * @requires vm.gc.Shenandoah & vm.opt.ShenandoahGCMode != "generational"
*
* @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
* -Dprecise=false
* TestChurnNotifications
/*
* @test id=static
* @summary Check that MX notifications are reported for all cycles
* @library /test/lib /
- * @requires vm.gc.Shenandoah
+ * @requires vm.gc.Shenandoah & vm.opt.ShenandoahGCMode != "generational"
*
* @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
* -Dprecise=false
* TestChurnNotifications
/*
* @test id=compact
* @summary Check that MX notifications are reported for all cycles
* @library /test/lib /
- * @requires vm.gc.Shenandoah
+ * @requires vm.gc.Shenandoah & vm.opt.ShenandoahGCMode != "generational"
*
* @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
* -Dprecise=false
* TestChurnNotifications
*/
+ /*
+ * @test id=generational
+ * @summary Check that MX notifications are reported for all cycles
+ * @library /test/lib /
+ * @requires vm.gc.Shenandoah
+ *
+ * @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
+ * -XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
+ * -Dprecise=false -Dmem.pool=Young
+ * TestChurnNotifications
+ */
+
import java.util.*;
import java.util.concurrent.atomic.*;
import javax.management.*;
import java.lang.management.*;
import javax.management.openmbean.*;
static final long M = 1024 * 1024;
static volatile Object sink;
+ private static final String POOL_NAME = "Young".equals(System.getProperty("mem.pool")) ? "Shenandoah Young Gen" : "Shenandoah";
+
public static void main(String[] args) throws Exception {
final long startTimeNanos = System.nanoTime();
final AtomicLong churnBytes = new AtomicLong();
if (n.getType().equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from((CompositeData) n.getUserData());
Map<String, MemoryUsage> mapBefore = info.getGcInfo().getMemoryUsageBeforeGc();
Map<String, MemoryUsage> mapAfter = info.getGcInfo().getMemoryUsageAfterGc();
- MemoryUsage before = mapBefore.get("Shenandoah");
- MemoryUsage after = mapAfter.get("Shenandoah");
+ MemoryUsage before = mapBefore.get(POOL_NAME);
+ MemoryUsage after = mapAfter.get(POOL_NAME);
if ((before != null) && (after != null)) {
long diff = before.getUsed() - after.getUsed();
if (diff > 0) {
churnBytes.addAndGet(diff);
< prev index next >