< prev index next >

test/runtime/CommandLine/PrintTouchedMethods.java

Print this page
rev 8734 : 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off.


  70       output.shouldHaveExitValue(0);
  71 
  72       String[] javaArgs3 = {"-XX:+UnlockDiagnosticVMOptions", "-Xint", "-XX:+LogTouchedMethods", "-XX:+PrintTouchedMethodsAtExit", "TestLogTouchedMethods"};
  73       pb = ProcessTools.createJavaProcessBuilder(javaArgs3);
  74       output = new OutputAnalyzer(pb.start());
  75       lines = output.asLines();
  76 
  77       if (lines.size() < 1) {
  78         throw new Exception("Empty output");
  79       }
  80 
  81       first = lines.get(0);
  82       if (!first.equals("# Method::print_touched_methods version 1")) {
  83         throw new Exception("First line mismatch");
  84       }
  85 
  86       output.shouldContain("TestLogTouchedMethods.methodA:()V");
  87       output.shouldNotContain("TestLogTouchedMethods.methodB:()V");
  88       output.shouldHaveExitValue(0);
  89 


















  90       // Test jcmd PrintTouchedMethods VM.print_touched_methods
  91       String pid = Integer.toString(ProcessTools.getProcessId());
  92       pb = new ProcessBuilder();
  93       pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.print_touched_methods"});
  94       output = new OutputAnalyzer(pb.start());
  95       try {
  96         output.shouldContain("PrintTouchedMethods.main:([Ljava/lang/String;)V");
  97       } catch (RuntimeException e) {
  98         output.shouldContain("Unknown diagnostic command");
  99       }
 100   }
 101 }


  70       output.shouldHaveExitValue(0);
  71 
  72       String[] javaArgs3 = {"-XX:+UnlockDiagnosticVMOptions", "-Xint", "-XX:+LogTouchedMethods", "-XX:+PrintTouchedMethodsAtExit", "TestLogTouchedMethods"};
  73       pb = ProcessTools.createJavaProcessBuilder(javaArgs3);
  74       output = new OutputAnalyzer(pb.start());
  75       lines = output.asLines();
  76 
  77       if (lines.size() < 1) {
  78         throw new Exception("Empty output");
  79       }
  80 
  81       first = lines.get(0);
  82       if (!first.equals("# Method::print_touched_methods version 1")) {
  83         throw new Exception("First line mismatch");
  84       }
  85 
  86       output.shouldContain("TestLogTouchedMethods.methodA:()V");
  87       output.shouldNotContain("TestLogTouchedMethods.methodB:()V");
  88       output.shouldHaveExitValue(0);
  89 
  90       String[] javaArgs4 = {"-XX:+UnlockDiagnosticVMOptions", "-Xint", "-XX:+LogTouchedMethods", "-XX:+PrintTouchedMethodsAtExit", "-XX:-TieredCompilation", "TestLogTouchedMethods"};
  91       pb = ProcessTools.createJavaProcessBuilder(javaArgs4);
  92       output = new OutputAnalyzer(pb.start());
  93       lines = output.asLines();
  94 
  95       if (lines.size() < 1) {
  96         throw new Exception("Empty output");
  97       }
  98 
  99       first = lines.get(0);
 100       if (!first.equals("# Method::print_touched_methods version 1")) {
 101         throw new Exception("First line mismatch");
 102       }
 103 
 104       output.shouldContain("TestLogTouchedMethods.methodA:()V");
 105       output.shouldNotContain("TestLogTouchedMethods.methodB:()V");
 106       output.shouldHaveExitValue(0);
 107 
 108       // Test jcmd PrintTouchedMethods VM.print_touched_methods
 109       String pid = Integer.toString(ProcessTools.getProcessId());
 110       pb = new ProcessBuilder();
 111       pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.print_touched_methods"});
 112       output = new OutputAnalyzer(pb.start());
 113       try {
 114         output.shouldContain("PrintTouchedMethods.main:([Ljava/lang/String;)V");
 115       } catch (RuntimeException e) {
 116         output.shouldContain("Unknown diagnostic command");
 117       }
 118   }
 119 }
< prev index next >