< prev index next > test/hotspot/jtreg/gc/shenandoah/mxbeans/TestPauseNotifications.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.
* @run main/othervm -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
* TestPauseNotifications
*/
+ /*
+ * @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
+ * TestPauseNotifications
+ */
+
import java.util.*;
import java.util.concurrent.atomic.*;
import javax.management.*;
import java.lang.management.*;
import javax.management.openmbean.*;
|| "Degenerated GC".equals(action) || "Init Update Refs".equals(action)
|| "Final Update Refs".equals(action) || "Final Roots".equals(action);
}
public static void main(String[] args) throws Exception {
! final long startTime = System.currentTimeMillis();
final AtomicLong pausesDuration = new AtomicLong();
final AtomicLong cyclesDuration = new AtomicLong();
final AtomicLong pausesCount = new AtomicLong();
final AtomicLong cyclesCount = new AtomicLong();
|| "Degenerated GC".equals(action) || "Init Update Refs".equals(action)
|| "Final Update Refs".equals(action) || "Final Roots".equals(action);
}
public static void main(String[] args) throws Exception {
! final long startTimeNanos = System.nanoTime();
final AtomicLong pausesDuration = new AtomicLong();
final AtomicLong cyclesDuration = new AtomicLong();
final AtomicLong pausesCount = new AtomicLong();
final AtomicLong cyclesCount = new AtomicLong();
}
// Look at test timeout to figure out how long we can wait without breaking into timeout.
// Default to 1/4 of the remaining time in 1s steps.
final long STEP_MS = 1000;
! long spentTime = System.currentTimeMillis() - startTime;
! long maxTries = (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) - spentTime) / STEP_MS / 4;
long actualPauses = 0;
long actualCycles = 0;
// Wait until enough notifications are accrued to match minimum boundary.
}
// Look at test timeout to figure out how long we can wait without breaking into timeout.
// Default to 1/4 of the remaining time in 1s steps.
final long STEP_MS = 1000;
! long spentTimeNanos = System.nanoTime() - startTimeNanos;
! long maxTries = (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) - (spentTimeNanos / 1_000_000L)) / STEP_MS / 4;
long actualPauses = 0;
long actualCycles = 0;
// Wait until enough notifications are accrued to match minimum boundary.
< prev index next >