/* * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
publicstaticvoid main(String args[]) throws Exception {
checkSetLimits();
SABase base = new SABase(args); boolean c2 = base.runServer.orElseThrow(() -> new Error("runServer must be set"));
String[] extra = {}; if (Platform.isTieredSupported()) { if (c2) { // Replay produced on first compilation. We want that // compilation delayed so profile data is produced.
extra = new String[] {"-XX:-TieredCompilation"};
} else {
extra = new String[] {"-XX:TieredStopAtLevel=1"};
}
}
base.runTest(/* needCoreDump = */ true, extra);
}
public SABase(String[] args) { super(args);
}
@Override publicvoid testAction() { try {
Files.move(Paths.get(REPLAY_FILE_NAME), Paths.get(REPLAY_FILE_COPY));
} catch (IOException ioe) { thrownew Error("Can't move files: " + ioe, ioe);
}
ProcessBuilder pb; try {
pb = ProcessTools.createTestJvm("--add-modules", "jdk.hotspot.agent", "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED", "sun.jvm.hotspot.CLHSDB", JDKToolFinder.getTestJDKTool("java"),
TEST_CORE_FILE_NAME);
} catch (Exception e) { thrownew Error("Can't create process builder: " + e, e);
}
Process p; try {
p = pb.start();
} catch (IOException ioe) { thrownew Error("Can't start child process: " + ioe, ioe);
}
OutputStream input = p.getOutputStream();
String str = "dumpreplaydata -a > " + REPLAY_FILE_NAME + "\nquit\n"; try {
input.write(str.getBytes());
input.flush();
} catch (IOException ioe) { thrownew Error("Problem writing process input: " + str, ioe);
} try {
p.waitFor();
} catch (InterruptedException ie) { thrownew Error("Problem waitinig child process: " + ie, ie);
} int exitValue = p.exitValue(); if (exitValue != 0) {
String output; try {
output = new OutputAnalyzer(p).getOutput();
} catch (IOException ioe) { thrownew Error("Can't get failed CLHSDB process output: " + ioe, ioe);
} thrownew AssertionError("CLHSDB wasn't run successfully: " + output);
}
File replay = new File(REPLAY_FILE_NAME);
Asserts.assertTrue(replay.exists() && replay.isFile() && replay.length() > 0, "Replay data wasn't generated by SA"); // other than comment lines, content of 2 files should be identical try {
BufferedReader rep = new BufferedReader(new FileReader(replay));
BufferedReader repCopy = new BufferedReader(new FileReader(REPLAY_FILE_COPY)); boolean failure = false; while (true) {
String l1; while ((l1 = rep.readLine()) != null) { if (!l1.startsWith("#")) { break;
}
}
String l2; while ((l2 = repCopy.readLine()) != null) { if (!l2.startsWith("#")) { break;
}
} if (l1 == null || l2 == null) { if (l1 != null || l2 != null) {
System.out.println("Warning: replay files are not equal");
System.out.println("1: " + l1);
System.out.println("2: " + l2);
failure = true;
} break;
} if (!l1.equals(l2)) {
System.out.println("Warning: replay files are not equal");
System.out.println("1: " + l1);
System.out.println("2: " + l2);
failure = true;
}
} if (failure) { thrownew RuntimeException("Warning: replay files are not equal");
}
} catch (IOException ioe) { thrownew Error("Can't read replay files: " + ioe, ioe);
}
commonTests();
runVmTests();
}
publicstaticvoid checkSetLimits() { if (!Platform.isWindows()) {
OutputAnalyzer oa; try { // first check if setting limit is possible
oa = ProcessTools.executeProcess("sh", "-c", RUN_SHELL_NO_LIMIT + "ulimit -c");
} catch (Throwable t) { thrownew Error("Can't set limits: " + t, t);
}
oa.shouldHaveExitValue(0);
String out = oa.getOutput().trim(); // cut win/*nix newlines if (!out.equals("unlimited") && !out.equals("-1")) { thrownew Error("Unable to set limits");
}
}
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
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.