jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest.java
author ykantser
Thu, 07 May 2015 09:11:49 +0200
changeset 30376 2ccf2cf7ea48
parent 29029 433de2a38271
child 32103 252be3ad6800
permissions -rw-r--r--
8078896: Add @modules as needed to the jdk_svc tests Reviewed-by: alanb, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
28527
38a80fae1b65 8062450: Timeout in LowMemoryTest.java
jbachorik
parents: 28245
diff changeset
     2
 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @bug     4530538
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Basic unit test of memory management testing:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *          1) setUsageThreshold() and getUsageThreshold()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *          2) test low memory detection on the old generation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * @author  Mandy Chung
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    33
 * @library /lib/testlibrary/
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 29029
diff changeset
    34
 * @modules java.management
24366
57c0a8b7a936 8034960: Serviceability tests using @library failing with java.lang.NoClassDefFoundError
ykantser
parents: 23933
diff changeset
    35
 * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil
29029
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
    36
  * @run main/timeout=600 LowMemoryTest
28527
38a80fae1b65 8062450: Timeout in LowMemoryTest.java
jbachorik
parents: 28245
diff changeset
    37
 * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
38a80fae1b65 8062450: Timeout in LowMemoryTest.java
jbachorik
parents: 28245
diff changeset
    38
 * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true"
38a80fae1b65 8062450: Timeout in LowMemoryTest.java
jbachorik
parents: 28245
diff changeset
    39
 * @requires vm.opt.DisableExplicitGC != "true"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.lang.management.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.util.*;
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
    44
import java.util.concurrent.Phaser;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import javax.management.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import javax.management.openmbean.CompositeData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
public class LowMemoryTest {
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
    49
    private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
    50
    private static final List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
    51
    private static final Phaser phaser = new Phaser(2);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    private static MemoryPoolMXBean mpool = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private static boolean trace = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private static boolean testFailed = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private static final int NUM_TRIGGERS = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private static final int NUM_CHUNKS = 2;
25999
1e494b91a5a5 8035939: java/lang/management/MemoryMXBean/MemoryManagement.java timed out on Linux-amd64
stefank
parents: 24366
diff changeset
    57
    private static final int YOUNG_GEN_SIZE = 8 * 1024 * 1024;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private static long chunkSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    60
    /**
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    61
     * Run the test multiple times with different GC versions.
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    62
     * First with default command line specified by the framework.
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    63
     * Then with GC versions specified by the test.
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    64
     */
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    65
    public static void main(String a[]) throws Throwable {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    66
        final String main = "LowMemoryTest$TestMain";
25999
1e494b91a5a5 8035939: java/lang/management/MemoryMXBean/MemoryManagement.java timed out on Linux-amd64
stefank
parents: 24366
diff changeset
    67
        // Use a low young gen size to ensure that the
1e494b91a5a5 8035939: java/lang/management/MemoryMXBean/MemoryManagement.java timed out on Linux-amd64
stefank
parents: 24366
diff changeset
    68
        // allocated objects are put in the old gen.
1e494b91a5a5 8035939: java/lang/management/MemoryMXBean/MemoryManagement.java timed out on Linux-amd64
stefank
parents: 24366
diff changeset
    69
        final String nmFlag = "-Xmn" + YOUNG_GEN_SIZE;
26459
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    70
        // Using large pages will change the young gen size,
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    71
        // make sure we don't use them for this test.
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    72
        final String lpFlag = "-XX:-UseLargePages";
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    73
        // Prevent G1 from selecting a large heap region size,
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    74
        // since that would change the young gen size.
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    75
        final String g1Flag = "-XX:G1HeapRegionSize=1m";
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    76
        RunUtil.runTestClearGcOpts(main, nmFlag, lpFlag, "-XX:+UseSerialGC");
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    77
        RunUtil.runTestClearGcOpts(main, nmFlag, lpFlag, "-XX:+UseParallelGC");
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    78
        RunUtil.runTestClearGcOpts(main, nmFlag, lpFlag, "-XX:+UseG1GC", g1Flag);
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
    79
        RunUtil.runTestClearGcOpts(main, nmFlag, lpFlag, "-XX:+UseConcMarkSweepGC");
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    80
    }
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
    81
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
    82
    private static volatile boolean listenerInvoked = false;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    static class SensorListener implements NotificationListener {
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
    84
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        public void handleNotification(Notification notif, Object handback) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            String type = notif.getType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            if (type.equals(MemoryNotificationInfo.MEMORY_THRESHOLD_EXCEEDED) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                type.equals(MemoryNotificationInfo.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                    MEMORY_COLLECTION_THRESHOLD_EXCEEDED)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                MemoryNotificationInfo minfo = MemoryNotificationInfo.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                    from((CompositeData) notif.getUserData());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                MemoryUtil.printMemoryNotificationInfo(minfo, type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                listenerInvoked = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    static class TestListener implements NotificationListener {
28245
5560f8810064 8034263: Test java/lang/management/MemoryMXBean/LowMemoryTest.java fails intermittently
jbachorik
parents: 26459
diff changeset
   101
        private boolean isRelaxed = false;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        private int triggers = 0;
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   103
        private final long[] count = new long[NUM_TRIGGERS * 2];
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   104
        private final long[] usedMemory = new long[NUM_TRIGGERS * 2];
28245
5560f8810064 8034263: Test java/lang/management/MemoryMXBean/LowMemoryTest.java fails intermittently
jbachorik
parents: 26459
diff changeset
   105
5560f8810064 8034263: Test java/lang/management/MemoryMXBean/LowMemoryTest.java fails intermittently
jbachorik
parents: 26459
diff changeset
   106
        public TestListener() {
5560f8810064 8034263: Test java/lang/management/MemoryMXBean/LowMemoryTest.java fails intermittently
jbachorik
parents: 26459
diff changeset
   107
            isRelaxed = ManagementFactory.getRuntimeMXBean().getInputArguments().contains("-XX:+UseConcMarkSweepGC");
5560f8810064 8034263: Test java/lang/management/MemoryMXBean/LowMemoryTest.java fails intermittently
jbachorik
parents: 26459
diff changeset
   108
        }
5560f8810064 8034263: Test java/lang/management/MemoryMXBean/LowMemoryTest.java fails intermittently
jbachorik
parents: 26459
diff changeset
   109
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   110
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        public void handleNotification(Notification notif, Object handback) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            MemoryNotificationInfo minfo = MemoryNotificationInfo.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
                from((CompositeData) notif.getUserData());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            count[triggers] = minfo.getCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            usedMemory[triggers] = minfo.getUsage().getUsed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            triggers++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        public void checkResult() throws Exception {
29029
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   119
            if (!checkValue(triggers, NUM_TRIGGERS)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                throw new RuntimeException("Unexpected number of triggers = " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                    triggers + " but expected to be " + NUM_TRIGGERS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            for (int i = 0; i < triggers; i++) {
29029
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   125
                if (!checkValue(count[i], i + 1)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                    throw new RuntimeException("Unexpected count of" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                        " notification #" + i +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                        " count = " + count[i] +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                        " but expected to be " + (i+1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                if (usedMemory[i] < newThreshold) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                    throw new RuntimeException("Used memory = " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                        usedMemory[i] + " is less than the threshold = " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                        newThreshold);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        }
29029
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   138
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   139
        private boolean checkValue(int value, int target) {
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   140
            return checkValue((long)value, target);
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   141
        }
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   142
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   143
        private boolean checkValue(long value, int target) {
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   144
            if (!isRelaxed) {
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   145
                return value == target;
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   146
            } else {
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   147
                return value >= target;
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   148
            }
433de2a38271 8069286: Unexpected count of notification in LowMemoryTest
jbachorik
parents: 28528
diff changeset
   149
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    private static long newThreshold;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   154
    private static class TestMain {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   155
        public static void main(String args[]) throws Exception {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   156
            if (args.length > 0 && args[0].equals("trace")) {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   157
                trace = true;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   160
            // Find the Old generation which supports low memory detection
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   161
            ListIterator iter = pools.listIterator();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   162
            while (iter.hasNext()) {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   163
                MemoryPoolMXBean p = (MemoryPoolMXBean) iter.next();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   164
                if (p.getType() == MemoryType.HEAP &&
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   165
                    p.isUsageThresholdSupported()) {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   166
                    mpool = p;
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   167
                    if (trace) {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   168
                        System.out.println("Selected memory pool for low memory " +
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   169
                            "detection.");
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   170
                        MemoryUtil.printMemoryPool(mpool);
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   171
                    }
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   172
                    break;
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   173
                }
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   174
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   176
            TestListener listener = new TestListener();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   177
            SensorListener l2 = new SensorListener();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   178
            NotificationEmitter emitter = (NotificationEmitter) mm;
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   179
            emitter.addNotificationListener(listener, null, null);
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   180
            emitter.addNotificationListener(l2, null, null);
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   181
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   182
            Thread allocator = new AllocatorThread();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   183
            Thread sweeper = new SweeperThread();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
26459
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   185
            // The chunk size needs to be larger than YOUNG_GEN_SIZE,
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   186
            // otherwise we will get intermittent failures when objects
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   187
            // end up in the young gen instead of the old gen.
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   188
            final long epsilon = 1024;
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   189
            chunkSize = YOUNG_GEN_SIZE + epsilon;
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   190
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   191
            MemoryUsage mu = mpool.getUsage();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   192
            newThreshold = mu.getUsed() + (chunkSize * NUM_CHUNKS);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
26459
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   194
            // Sanity check. Make sure the new threshold isn't too large.
25999
1e494b91a5a5 8035939: java/lang/management/MemoryMXBean/MemoryManagement.java timed out on Linux-amd64
stefank
parents: 24366
diff changeset
   195
            // Tweak the test if this fails.
26459
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   196
            final long headRoom = chunkSize * 2;
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   197
            final long max = mu.getMax();
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   198
            if (max != -1 && newThreshold > max - headRoom) {
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   199
                throw new RuntimeException("TEST FAILED: newThreshold: " + newThreshold +
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   200
                        " is too near the maximum old gen size: " + max +
fa5576f930e6 8057174: MemoryMXBean tests -- TEST FAILED: chunkSize: 6291456 is less than YOUNG_GEN_SIZE: 8388608
stefank
parents: 25999
diff changeset
   201
                        " used: " + mu.getUsed() + " headRoom: " + headRoom);
25999
1e494b91a5a5 8035939: java/lang/management/MemoryMXBean/MemoryManagement.java timed out on Linux-amd64
stefank
parents: 24366
diff changeset
   202
            }
1e494b91a5a5 8035939: java/lang/management/MemoryMXBean/MemoryManagement.java timed out on Linux-amd64
stefank
parents: 24366
diff changeset
   203
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   204
            System.out.println("Setting threshold for " + mpool.getName() +
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   205
                " from " + mpool.getUsageThreshold() + " to " + newThreshold +
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   206
                ".  Current used = " + mu.getUsed());
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   207
            mpool.setUsageThreshold(newThreshold);
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   208
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   209
            if (mpool.getUsageThreshold() != newThreshold) {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   210
                throw new RuntimeException("TEST FAILED: " +
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                "Threshold for Memory pool " + mpool.getName() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                "is " + mpool.getUsageThreshold() + " but expected to be" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                newThreshold);
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   214
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   216
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   217
            allocator.start();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   218
            // Force Allocator start first
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   219
            phaser.arriveAndAwaitAdvance();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   220
            sweeper.start();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   222
23933
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   223
            try {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   224
                allocator.join();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   225
                // Wait until AllocatorThread's done
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   226
                phaser.arriveAndAwaitAdvance();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   227
                sweeper.join();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   228
            } catch (InterruptedException e) {
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   229
                System.out.println("Unexpected exception:" + e);
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   230
                testFailed = true;
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   231
            }
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   232
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   233
            listener.checkResult();
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   234
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   235
            if (testFailed)
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   236
                throw new RuntimeException("TEST FAILED.");
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   237
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   238
            System.out.println(RunUtil.successMessage);
754ee146b623 8030628: Update java/lang/management/MemoryMXBean tests to ignore GC setting by jtreg
mtobiass
parents: 22075
diff changeset
   239
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    private static void goSleep(long ms) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            Thread.sleep(ms);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        } catch (InterruptedException e) {
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   247
            System.out.println("Unexpected exception:" + e);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            testFailed = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   252
    private static final List<Object> objectPool = new ArrayList<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    static class AllocatorThread extends Thread {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        public void doTask() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            int iterations = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            int numElements = (int) (chunkSize / 4); // minimal object size
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   257
            while (!listenerInvoked || mpool.getUsage().getUsed() < mpool.getUsageThreshold()) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                iterations++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                if (trace) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                    System.out.println("   Iteration " + iterations +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                        ": before allocation " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                        mpool.getUsage().getUsed());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                Object[] o = new Object[numElements];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                if (iterations <= NUM_CHUNKS) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                    // only hold a reference to the first NUM_CHUNKS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                    // allocated objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                    objectPool.add(o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                if (trace) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                    System.out.println("               " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                        "  after allocation " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                        mpool.getUsage().getUsed());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
                goSleep(100);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        }
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   280
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
            for (int i = 1; i <= NUM_TRIGGERS; i++) {
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   283
                // Sync with SweeperThread's second phase.
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   284
                phaser.arriveAndAwaitAdvance();
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   285
                System.out.println("AllocatorThread is doing task " + i +
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   286
                    " phase " + phaser.getPhase());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                doTask();
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   288
                // Sync with SweeperThread's first phase.
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   289
                phaser.arriveAndAwaitAdvance();
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   290
                System.out.println("AllocatorThread done task " + i +
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   291
                    " phase " + phaser.getPhase());
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   292
                if (testFailed) {
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   293
                    return;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    static class SweeperThread extends Thread {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        private void doTask() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
            for (; mpool.getUsage().getUsed() >=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                       mpool.getUsageThreshold();) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                // clear all allocated objects and invoke GC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                objectPool.clear();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                mm.gc();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                goSleep(100);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        }
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   309
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
            for (int i = 1; i <= NUM_TRIGGERS; i++) {
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   312
                // Sync with AllocatorThread's first phase.
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   313
                phaser.arriveAndAwaitAdvance();
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   314
                System.out.println("SweepThread is doing task " + i +
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   315
                    " phase " + phaser.getPhase());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                doTask();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                listenerInvoked = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
22075
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   320
                // Sync with AllocatorThread's second phase.
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   321
                phaser.arriveAndAwaitAdvance();
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   322
                System.out.println("SweepThread done task " + i +
4c204174a8d9 8029346: LowMemoryTestConcMarkSweepGC.sh fails intermittently with timeout
mchung
parents: 7668
diff changeset
   323
                    " phase " + phaser.getPhase());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                if (testFailed) return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
}