publicstatic Path createProfilingRecording() throws Exception {
Path file = Utils.createTempFile("profiling-recording", ".jfr"); // Create a recording with some data try (Recording r = new Recording(Configuration.getConfiguration("profile"))) {
r.start();
// Allocation event
array = new Object[1000000];
array = null;
// Class loading event etc
provokeClassLoading();
// GC events
System.gc();
// ExecutionSample long t = System.currentTimeMillis(); while (System.currentTimeMillis() - t < 50) { // do nothing
}
// Other periodic events, i.e CPU load Thread.sleep(1000);
r.stop();
r.dump(file);
}
return file;
}
privatestaticvoid provokeClassLoading() { // Matching a string with regexp // is expected to load some classes and generate some VM events
Pattern p = Pattern.compile("a*b");
Matcher m = p.matcher("aaaaab");
m.matches();
}
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.