< prev index next >

test/hotspot/jtreg/serviceability/sa/TestInstanceKlassSize.java

Print this page

  1 /*
  2  * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */

 50  * @modules java.base/jdk.internal.misc
 51  *          jdk.hotspot.agent/sun.jvm.hotspot
 52  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
 53  *          jdk.hotspot.agent/sun.jvm.hotspot.oops
 54  *          jdk.hotspot.agent/sun.jvm.hotspot.debugger
 55  * @build jdk.test.whitebox.WhiteBox
 56  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
 57  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestInstanceKlassSize
 58  */
 59 
 60 import jdk.test.whitebox.WhiteBox;
 61 
 62 public class TestInstanceKlassSize {
 63 
 64     public static WhiteBox wb = WhiteBox.getWhiteBox();
 65     private static String[] SAInstanceKlassNames = new String[] {
 66                                                 "java.lang.Object",
 67                                                 "java.util.ArrayList",
 68                                                 "java.lang.String",
 69                                                 "java.lang.Thread",
 70                                                 "java.lang.Byte"
 71                                              };
 72 
 73     private static void startMeWithArgs() throws Exception {
 74 
 75         LingeredApp app = null;
 76         OutputAnalyzer output = null;
 77         try {
 78             app = LingeredApp.startApp("-XX:+UsePerfData");
 79             System.out.println ("Started LingeredApp with pid " + app.getPid());
 80         } catch (Exception ex) {
 81             ex.printStackTrace();
 82             throw new RuntimeException(ex);
 83         }
 84         try {
 85             // Run this app with the LingeredApp PID to get SA output from the LingeredApp
 86             ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder(
 87                 "--add-modules=jdk.hotspot.agent",
 88                 "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
 89                 "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
 90                 "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",

  1 /*
  2  * Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */

 50  * @modules java.base/jdk.internal.misc
 51  *          jdk.hotspot.agent/sun.jvm.hotspot
 52  *          jdk.hotspot.agent/sun.jvm.hotspot.utilities
 53  *          jdk.hotspot.agent/sun.jvm.hotspot.oops
 54  *          jdk.hotspot.agent/sun.jvm.hotspot.debugger
 55  * @build jdk.test.whitebox.WhiteBox
 56  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
 57  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestInstanceKlassSize
 58  */
 59 
 60 import jdk.test.whitebox.WhiteBox;
 61 
 62 public class TestInstanceKlassSize {
 63 
 64     public static WhiteBox wb = WhiteBox.getWhiteBox();
 65     private static String[] SAInstanceKlassNames = new String[] {
 66                                                 "java.lang.Object",
 67                                                 "java.util.ArrayList",
 68                                                 "java.lang.String",
 69                                                 "java.lang.Thread",

 70                                              };
 71 
 72     private static void startMeWithArgs() throws Exception {
 73 
 74         LingeredApp app = null;
 75         OutputAnalyzer output = null;
 76         try {
 77             app = LingeredApp.startApp("-XX:+UsePerfData");
 78             System.out.println ("Started LingeredApp with pid " + app.getPid());
 79         } catch (Exception ex) {
 80             ex.printStackTrace();
 81             throw new RuntimeException(ex);
 82         }
 83         try {
 84             // Run this app with the LingeredApp PID to get SA output from the LingeredApp
 85             ProcessBuilder processBuilder = ProcessTools.createLimitedTestJavaProcessBuilder(
 86                 "--add-modules=jdk.hotspot.agent",
 87                 "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
 88                 "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
 89                 "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
< prev index next >