hotspot/test/runtime/NMT/ChangeTrackingLevel.java
author goetz
Tue, 30 Aug 2016 16:08:52 +0200
changeset 41086 06b10263e509
parent 40631 ed82623d7831
permissions -rw-r--r--
8165315: [ppc] Port "8133749: NMT detail stack trace cleanup" Summary: Also add methods to check for slow/fastdebug to Platform.java. Reviewed-by: simonis, cjplummer, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
     1
/*
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 38152
diff changeset
     2
 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
     4
 *
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
     8
 *
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    13
 * accompanied this code).
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    14
 *
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    18
 *
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    21
 * questions.
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    22
 */
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    23
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    24
/*
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    25
 * @test
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    26
 * @bug 8059100
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    27
 * @summary Test that you can decrease NMT tracking level but not increase it.
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    28
 * @key nmt
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 33730
diff changeset
    29
 * @modules java.base/jdk.internal.misc
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 38152
diff changeset
    30
 * @library /test/lib
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 38152
diff changeset
    31
 * @build sun.hotspot.WhiteBox
27162
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    32
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    33
 *                              sun.hotspot.WhiteBox$WhiteBoxPermission
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    34
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail ChangeTrackingLevel
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    35
 */
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    36
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    37
import sun.hotspot.WhiteBox;
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    38
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    39
public class ChangeTrackingLevel {
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    40
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    41
    public static WhiteBox wb = WhiteBox.getWhiteBox();
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    42
    public static void main(String args[]) throws Exception {
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    43
        boolean testChangeLevel = wb.NMTChangeTrackingLevel();
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    44
        if (testChangeLevel) {
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    45
            System.out.println("NMT level change test passed.");
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    46
        } else {
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    47
            // it also fails if the VM asserts.
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    48
            throw new RuntimeException("NMT level change test failed");
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    49
        }
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    50
    }
0a4a7276949b 8059100: SIGSEGV VirtualMemoryTracker::remove_released_region
coleenp
parents:
diff changeset
    51
};