static String cmTrace(String stressOpt, int stressSeed) throws Exception {
String className = TestStressCM.class.getName();
String[] procArgs = { "-Xcomp", "-XX:-TieredCompilation", "-XX:-Inline", "-XX:CompileOnly=" + className + "::sum", "-XX:+TraceOptoPipelining", "-XX:+" + stressOpt, "-XX:StressSeed=" + stressSeed, className, "10"};
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(procArgs);
OutputAnalyzer out = new OutputAnalyzer(pb.start());
out.shouldHaveExitValue(0); // Extract the trace of our method (the last one after those of all // mandatory stubs such as _new_instance_Java, etc.).
String [] traces = out.getStdout().split("\\R"); int start = -1; for (int i = traces.length - 1; i >= 0; i--) { if (traces[i].contains("Start GlobalCodeMotion")) {
start = i; break;
}
} // We should have found the start of the trace.
Asserts.assertTrue(start >= 0, "could not find the code motion trace");
String trace = ""; for (int i = start; i < traces.length; i++) {
trace += traces[i] + "\n";
} return trace;
}
staticvoid sum(int n) { int acc = 0; for (int i = 0; i < n; i++) acc += i;
System.out.println(acc);
}
publicstaticvoid main(String[] args) throws Exception { if (args[0].startsWith("Stress")) {
String stressOpt = args[0]; for (int s = 0; s < 10; s++) {
Asserts.assertEQ(cmTrace(stressOpt, s), cmTrace(stressOpt, s), "got different code motion traces for the same seed " + s);
}
} elseif (args.length > 0) {
sum(Integer.parseInt(args[0]));
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.8 Sekunden
(vorverarbeitet am 2026-06-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.