hotspot/test/runtime/memory/ReadVMPageSize.java
author mlarsson
Tue, 29 Mar 2016 09:43:05 +0200
changeset 37201 928cf689af1a
parent 33730 30e064828045
child 38152 80e5da81fb2c
permissions -rw-r--r--
8151993: Remove inclusion of inline.hpp in log.hpp Reviewed-by: kbarrett, stefank
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27876
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
     1
/*
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 28190
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
27876
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
     4
 *
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
     7
 * published by the Free Software Foundation.
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
     8
 *
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    13
 * accompanied this code).
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    14
 *
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    18
 *
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    21
 * questions.
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    22
 */
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    23
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    24
/*
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    25
 * @test
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    26
 * @summary Using WhiteBox to get VM page size
33730
30e064828045 8140189: [TESTBUG] Get rid of "@library /../../test/lib" in jtreg tests
cjplummer
parents: 30604
diff changeset
    27
 * @library /testlibrary /test/lib
27876
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    28
 * @build ReadVMPageSize
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    29
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    30
 * @run main/othervm  -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI  ReadVMPageSize
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    31
 */
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    32
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 28190
diff changeset
    33
import jdk.test.lib.*;
27876
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    34
import sun.hotspot.WhiteBox;
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    35
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    36
public class ReadVMPageSize {
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    37
  public static void main(String args[]) throws Exception {
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    38
    WhiteBox wb = WhiteBox.getWhiteBox();
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    39
    int pageSize = wb.getVMPageSize();
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    40
    if (pageSize < 0) {
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    41
      throw new Exception("pageSize < 0");
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    42
    } else {
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    43
      System.out.println("Page size = " + pageSize);
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    44
    }
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    45
  }
91fd97d8eb71 8053995: Add method to WhiteBox to get vm pagesize.
minqi
parents:
diff changeset
    46
}