OpenJDK / jdk / jdk
changeset 60350:b324ae69f933
8249787: Make TestGCLocker more resilient with concurrent GCs
Reviewed-by: eosterlund, tschatzl
author | rkennke |
---|---|
date | Thu, 23 Jul 2020 14:44:13 +0200 |
parents | 9d2325745d59 |
children | b9e3a25945f0 |
files | test/hotspot/jtreg/gc/stress/gclocker/TestGCLocker.java test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithShenandoah.java |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/test/hotspot/jtreg/gc/stress/gclocker/TestGCLocker.java Wed Jul 22 19:17:32 2020 -0700 +++ b/test/hotspot/jtreg/gc/stress/gclocker/TestGCLocker.java Thu Jul 23 14:44:13 2020 +0200 @@ -80,13 +80,14 @@ private final int criticalThresholdPromille = 800; private final int minGCWaitMS = 1000; private final int minFreeWaitElapsedMS = 30000; - private final int minFreeCriticalWaitMS = 500; + private final int minFreeCriticalWaitMS; private int lastUsage = 0; private long lastGCDetected = System.currentTimeMillis(); private long lastFree = System.currentTimeMillis(); - public MemoryWatcher(String mxBeanName) { + public MemoryWatcher(String mxBeanName, int minFreeCriticalWaitMS) { + this.minFreeCriticalWaitMS = minFreeCriticalWaitMS; List<MemoryPoolMXBean> memoryBeans = ManagementFactory.getMemoryPoolMXBeans(); for (MemoryPoolMXBean bean : memoryBeans) { if (bean.getName().equals(mxBeanName)) { @@ -151,8 +152,8 @@ cache.add(new Filler()); } - public MemoryUser(String mxBeanName) { - watcher = new MemoryWatcher(mxBeanName); + public MemoryUser(String mxBeanName, int minFreeCriticalWaitMS) { + watcher = new MemoryWatcher(mxBeanName, minFreeCriticalWaitMS); } @Override @@ -191,8 +192,8 @@ return task; } - private static Exitable startMemoryUser(String mxBeanName) { - MemoryUser task = new MemoryUser(mxBeanName); + private static Exitable startMemoryUser(String mxBeanName, int minFreeCriticalWaitMS) { + MemoryUser task = new MemoryUser(mxBeanName, minFreeCriticalWaitMS); Thread thread = new Thread(task); thread.setName("Memory User"); @@ -206,12 +207,13 @@ long durationMinutes = args.length > 0 ? Long.parseLong(args[0]) : 5; String mxBeanName = args.length > 1 ? args[1] : null; + int minFreeCriticalWaitMS = args.length > 2 ? Integer.parseInt(args[2]) : 500; long startMS = System.currentTimeMillis(); Exitable stresser1 = startGCLockerStresser("GCLockerStresser1"); Exitable stresser2 = startGCLockerStresser("GCLockerStresser2"); - Exitable memoryUser = startMemoryUser(mxBeanName); + Exitable memoryUser = startMemoryUser(mxBeanName, minFreeCriticalWaitMS); long durationMS = durationMinutes * 60 * 1000; while ((System.currentTimeMillis() - startMS) < durationMS) {
--- a/test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithShenandoah.java Wed Jul 22 19:17:32 2020 -0700 +++ b/test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithShenandoah.java Thu Jul 23 14:44:13 2020 +0200 @@ -51,7 +51,7 @@ */ public class TestGCLockerWithShenandoah { public static void main(String[] args) { - String[] testArgs = {"2", "Shenandoah heap"}; + String[] testArgs = {"2", "Shenandoah", "0"}; TestGCLocker.main(testArgs); } }