58 private static final int NUM_GCS = 3;
59 private static final int THRESHOLD = 10;
60 private static volatile int numGCs = 0;
61
62 // semaphore to signal the arrival of a low memory notification
63 private static final Semaphore signals = new Semaphore(0);
64 // barrier for the main thread to wait until the checker thread
65 // finishes checking the low memory notification result
66 private static final CyclicBarrier barrier = new CyclicBarrier(2);
67
68 /**
69 * Run the test multiple times with different GC versions.
70 * First with default command line specified by the framework.
71 * Then with GC versions specified by the test.
72 */
73 public static void main(String a[]) throws Throwable {
74 final String main = "CollectionUsageThreshold$TestMain";
75 RunUtil.runTestKeepGcOpts(main);
76 RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
77 RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
78 RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC");
79 if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
80 RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
81 }
82 }
83
84 static class PoolRecord {
85 private final MemoryPoolMXBean pool;
86 private final AtomicInteger listenerInvoked = new AtomicInteger(0);
87 private volatile long notifCount = 0;
88 PoolRecord(MemoryPoolMXBean p) {
89 this.pool = p;
90 }
91 int getListenerInvokedCount() {
92 return listenerInvoked.get();
93 }
94 long getNotifCount() {
95 return notifCount;
96 }
97 MemoryPoolMXBean getPool() {
98 return pool;
|
58 private static final int NUM_GCS = 3;
59 private static final int THRESHOLD = 10;
60 private static volatile int numGCs = 0;
61
62 // semaphore to signal the arrival of a low memory notification
63 private static final Semaphore signals = new Semaphore(0);
64 // barrier for the main thread to wait until the checker thread
65 // finishes checking the low memory notification result
66 private static final CyclicBarrier barrier = new CyclicBarrier(2);
67
68 /**
69 * Run the test multiple times with different GC versions.
70 * First with default command line specified by the framework.
71 * Then with GC versions specified by the test.
72 */
73 public static void main(String a[]) throws Throwable {
74 final String main = "CollectionUsageThreshold$TestMain";
75 RunUtil.runTestKeepGcOpts(main);
76 RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
77 RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
78 RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC", "-XX:-G1UseLegacyMonitoring");
79 RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC", "-XX:+G1UseLegacyMonitoring");
80 if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
81 RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
82 }
83 }
84
85 static class PoolRecord {
86 private final MemoryPoolMXBean pool;
87 private final AtomicInteger listenerInvoked = new AtomicInteger(0);
88 private volatile long notifCount = 0;
89 PoolRecord(MemoryPoolMXBean p) {
90 this.pool = p;
91 }
92 int getListenerInvokedCount() {
93 return listenerInvoked.get();
94 }
95 long getNotifCount() {
96 return notifCount;
97 }
98 MemoryPoolMXBean getPool() {
99 return pool;
|