test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff test/hotspot/jtreg/runtime/appcds/javaldr

test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java

Print this page




  39 import jdk.test.lib.process.OutputAnalyzer;
  40 import jdk.test.lib.process.ProcessTools;
  41 
  42 public class GCDuringDump {
  43     public static String appClasses[] = {
  44         "Hello",
  45     };
  46     public static String agentClasses[] = {
  47         "GCDuringDumpTransformer",
  48     };
  49 
  50     public static void main(String[] args) throws Throwable {
  51         String agentJar =
  52             ClassFileInstaller.writeJar("GCDuringDumpTransformer.jar",
  53                                         ClassFileInstaller.Manifest.fromSourceFile("GCDuringDumpTransformer.mf"),
  54                                         agentClasses);
  55 
  56         String appJar =
  57             ClassFileInstaller.writeJar("GCDuringDumpApp.jar", appClasses);
  58 
  59         String gcLog = "-Xlog:gc*=info,gc+region=trace,gc+alloc+region=debug";
  60 
  61         for (int i=0; i<2; i++) {
  62             // i = 0 -- run without agent = no extra GCs
  63             // i = 1 -- run with agent = cause extra GCs
  64 
  65             String extraArg = (i == 0) ? "-showversion" : "-javaagent:" + agentJar;
  66 
  67             TestCommon.testDump(appJar, TestCommon.list("Hello"),
  68                                 extraArg, "-Xmx32m", gcLog);
  69 
  70             TestCommon.run(
  71                 "-cp", appJar,
  72                 "-Xmx32m",
  73                 "-XX:+PrintSharedSpaces",
  74                 gcLog,
  75                 "Hello")
  76               .assertNormalExit();
  77         }
  78     }
  79 }
  80 


  39 import jdk.test.lib.process.OutputAnalyzer;
  40 import jdk.test.lib.process.ProcessTools;
  41 
  42 public class GCDuringDump {
  43     public static String appClasses[] = {
  44         "Hello",
  45     };
  46     public static String agentClasses[] = {
  47         "GCDuringDumpTransformer",
  48     };
  49 
  50     public static void main(String[] args) throws Throwable {
  51         String agentJar =
  52             ClassFileInstaller.writeJar("GCDuringDumpTransformer.jar",
  53                                         ClassFileInstaller.Manifest.fromSourceFile("GCDuringDumpTransformer.mf"),
  54                                         agentClasses);
  55 
  56         String appJar =
  57             ClassFileInstaller.writeJar("GCDuringDumpApp.jar", appClasses);
  58 


  59         for (int i=0; i<2; i++) {
  60             // i = 0 -- run without agent = no extra GCs
  61             // i = 1 -- run with agent = cause extra GCs
  62 
  63             String extraArg = (i == 0) ? "-showversion" : "-javaagent:" + agentJar;
  64 
  65             TestCommon.testDump(appJar, TestCommon.list("Hello"),
  66                                 extraArg, "-Xmx32m");
  67 
  68             TestCommon.run(
  69                 "-cp", appJar,
  70                 "-Xmx32m",
  71                 "-XX:+PrintSharedSpaces",

  72                 "Hello")
  73               .assertNormalExit();
  74         }
  75     }
  76 }
  77 
test/hotspot/jtreg/runtime/appcds/javaldr/GCDuringDump.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File