< prev index next >

test/hotspot/jtreg/gc/stress/systemgc/TestSystemGC.java

Print this page
rev 47694 : imported patch 8190703-testsystemgc-timeout
rev 47695 : [mq]: 8190703-ashipilev-review2

*** 88,106 **** class SystemGCTask extends Exitable implements Runnable { private long delayMS; SystemGCTask(long delayMS) { - System.err.println("SystemGCTask with delay " + delayMS); this.delayMS = delayMS; } @Override public void run() { while (!shouldExit()) { System.gc(); ! ThreadUtils.sleep(delayMS * 10); } } } public class TestSystemGC { --- 88,105 ---- class SystemGCTask extends Exitable implements Runnable { private long delayMS; SystemGCTask(long delayMS) { this.delayMS = delayMS; } @Override public void run() { while (!shouldExit()) { System.gc(); ! ThreadUtils.sleep(delayMS); } } } public class TestSystemGC {
*** 163,174 **** task.exit(); } } private static void runAllPhases() { ! int i = 0; ! while (i < 4 && System.currentTimeMillis() < endTime) { SystemGCTask gcTask = (i % 2 == 1) ? createSystemGCTask(numGroups / 3) : null; ShortLivedAllocationTask shortTask = (i == 1 || i == 3) ? new ShortLivedAllocationTask() : null; LongLivedAllocationTask longTask = --- 162,172 ---- task.exit(); } } private static void runAllPhases() { ! for (int i = 0; i < 4 && System.currentTimeMillis() < endTime; i++) { SystemGCTask gcTask = (i % 2 == 1) ? createSystemGCTask(numGroups / 3) : null; ShortLivedAllocationTask shortTask = (i == 1 || i == 3) ? new ShortLivedAllocationTask() : null; LongLivedAllocationTask longTask =
*** 183,202 **** exitTask(gcTask); exitTask(shortTask); exitTask(longTask); ThreadUtils.sleep(1000); - i++; } } ! public static void main(String[] args) { ! if (args.length > 0) { int timeout = Integer.parseInt(args[0]) * 1000; System.out.println("Running with timeout of " + timeout + "ms"); endTime = System.currentTimeMillis() + timeout; - } // First allocate the long lived objects and then run all phases. populateLongLived(); runAllPhases(); } } --- 181,200 ---- exitTask(gcTask); exitTask(shortTask); exitTask(longTask); ThreadUtils.sleep(1000); } } ! public static void main(String[] args) throws Exception { ! if (args.length == 0) { ! throw new IllegalArgumentException("Must specify timeout in seconds as first argument"); ! } int timeout = Integer.parseInt(args[0]) * 1000; System.out.println("Running with timeout of " + timeout + "ms"); endTime = System.currentTimeMillis() + timeout; // First allocate the long lived objects and then run all phases. populateLongLived(); runAllPhases(); } }
< prev index next >