jdk.jfr.internal.Repository Java Examples
The following examples show how to use
jdk.jfr.internal.Repository.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlightRecorder.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Returns the Flight Recorder for the platform. * * @return a Flight Recorder instance, not {@code null} * * @throws IllegalStateException if the platform Flight Recorder couldn't be * created (for example, if the file repository can't be created or * accessed) * * @throws SecurityException if a security manager exists and the caller does * not have {@code FlightRecorderPermission("accessFlightRecorder")} */ public static FlightRecorder getFlightRecorder() throws IllegalStateException, SecurityException { synchronized (PlatformRecorder.class) { Utils.checkAccessFlightRecorder(); JVMSupport.ensureWithIllegalStateException(); if (platformRecorder == null) { try { platformRecorder = new FlightRecorder(new PlatformRecorder()); } catch (IllegalStateException ise) { throw ise; } catch (Exception e) { throw new IllegalStateException("Can't create Flight Recorder. " + e.getMessage(), e); } // Must be in synchronized block to prevent instance leaking out // before initialization is done initialized = true; Logger.log(JFR, INFO, "Flight Recorder initialized"); Logger.log(JFR, DEBUG, "maxchunksize: " + Options.getMaxChunkSize()+ " bytes"); Logger.log(JFR, DEBUG, "memorysize: " + Options.getMemorySize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffersize: " + Options.getGlobalBufferSize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffercount: " + Options.getGlobalBufferCount()); Logger.log(JFR, DEBUG, "dumppath: " + Options.getDumpPath()); Logger.log(JFR, DEBUG, "samplethreads: " + Options.getSampleThreads()); Logger.log(JFR, DEBUG, "stackdepth: " + Options.getStackDepth()); Logger.log(JFR, DEBUG, "threadbuffersize: " + Options.getThreadBufferSize()); Logger.log(JFR, LogLevel.INFO, "Created repository " + Repository.getRepository().getRepositoryPath().toString()); PlatformRecorder.notifyRecorderInitialized(platformRecorder); } } return platformRecorder; }
Example #2
Source File: FlightRecorder.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the Flight Recorder for the platform. * * @return a Flight Recorder instance, not {@code null} * * @throws IllegalStateException if Flight Recorder can't be created (for * example, if the Java Virtual Machine (JVM) lacks Flight Recorder * support, or if the file repository can't be created or accessed) * * @throws SecurityException if a security manager exists and the caller does * not have {@code FlightRecorderPermission("accessFlightRecorder")} */ public static FlightRecorder getFlightRecorder() throws IllegalStateException, SecurityException { synchronized (PlatformRecorder.class) { Utils.checkAccessFlightRecorder(); JVMSupport.ensureWithIllegalStateException(); if (platformRecorder == null) { try { platformRecorder = new FlightRecorder(new PlatformRecorder()); } catch (IllegalStateException ise) { throw ise; } catch (Exception e) { throw new IllegalStateException("Can't create Flight Recorder. " + e.getMessage(), e); } // Must be in synchronized block to prevent instance leaking out // before initialization is done initialized = true; Logger.log(JFR, INFO, "Flight Recorder initialized"); Logger.log(JFR, DEBUG, "maxchunksize: " + Options.getMaxChunkSize()+ " bytes"); Logger.log(JFR, DEBUG, "memorysize: " + Options.getMemorySize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffersize: " + Options.getGlobalBufferSize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffercount: " + Options.getGlobalBufferCount()); Logger.log(JFR, DEBUG, "dumppath: " + Options.getDumpPath()); Logger.log(JFR, DEBUG, "samplethreads: " + Options.getSampleThreads()); Logger.log(JFR, DEBUG, "stackdepth: " + Options.getStackDepth()); Logger.log(JFR, DEBUG, "threadbuffersize: " + Options.getThreadBufferSize()); Logger.log(JFR, LogLevel.INFO, "Created repository " + Repository.getRepository().getRepositoryPath().toString()); PlatformRecorder.notifyRecorderInitialized(platformRecorder); } } return platformRecorder; }
Example #3
Source File: FlightRecorder.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Returns the Flight Recorder for the platform. * * @return a Flight Recorder instance, not {@code null} * * @throws IllegalStateException if Flight Recorder can't be created (for * example, if the Java Virtual Machine (JVM) lacks Flight Recorder * support, or if the file repository can't be created or accessed) * * @throws SecurityException if a security manager exists and the caller does * not have {@code FlightRecorderPermission("accessFlightRecorder")} */ public static FlightRecorder getFlightRecorder() throws IllegalStateException, SecurityException { synchronized (PlatformRecorder.class) { Utils.checkAccessFlightRecorder(); JVMSupport.ensureWithIllegalStateException(); if (platformRecorder == null) { try { platformRecorder = new FlightRecorder(new PlatformRecorder()); } catch (IllegalStateException ise) { throw ise; } catch (Exception e) { throw new IllegalStateException("Can't create Flight Recorder. " + e.getMessage(), e); } // Must be in synchronized block to prevent instance leaking out // before initialization is done initialized = true; Logger.log(JFR, INFO, "Flight Recorder initialized"); Logger.log(JFR, DEBUG, "maxchunksize: " + Options.getMaxChunkSize()+ " bytes"); Logger.log(JFR, DEBUG, "memorysize: " + Options.getMemorySize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffersize: " + Options.getGlobalBufferSize()+ " bytes"); Logger.log(JFR, DEBUG, "globalbuffercount: " + Options.getGlobalBufferCount()); Logger.log(JFR, DEBUG, "dumppath: " + Options.getDumpPath()); Logger.log(JFR, DEBUG, "samplethreads: " + Options.getSampleThreads()); Logger.log(JFR, DEBUG, "stackdepth: " + Options.getStackDepth()); Logger.log(JFR, DEBUG, "threadbuffersize: " + Options.getThreadBufferSize()); Logger.log(JFR, LogLevel.INFO, "Created repository " + Repository.getRepository().getRepositoryPath().toString()); PlatformRecorder.notifyRecorderInitialized(platformRecorder); } } return platformRecorder; }
Example #4
Source File: DCmdConfigure.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private void printRepositoryPath() { print("Repository path: "); printPath(Repository.getRepository().getRepositoryPath()); println(); }
Example #5
Source File: TestReconstruct.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("resource") public static void main(String[] args) throws Exception { // Create some disk recordings Recording[] recordings = new Recording[5]; for (int i = 0; i < RECORDING_COUNT; i++) { Recording r = new Recording(); r.setToDisk(true); r.start(); CorrelationEvent ce = new CorrelationEvent(); ce.id = i; ce.commit(); r.stop(); recordings[i] = r; } Path dir = Paths.get("reconstruction-parts"); Files.createDirectories(dir); long expectedCount = 0; for (int i = 0; i < RECORDING_COUNT; i++) { Path tmp = dir.resolve("chunk-part-" + i + ".jfr"); recordings[i].dump(tmp); expectedCount += countEventInRecording(tmp); } SafePath repository = Repository.getRepository().getRepositoryPath(); Path destinationPath = Paths.get("reconstructed.jfr"); String directory = repository.toString(); String destination = destinationPath.toAbsolutePath().toString(); // Test failure OutputAnalyzer output = ExecuteHelper.run("reconstruct"); output.shouldContain("Too few arguments"); output = ExecuteHelper.run("reconstruct", directory); output.shouldContain("Too few arguments"); output = ExecuteHelper.run("reconstruct", "not-a-directory", destination); output.shouldContain("Could not find disk repository at"); output = ExecuteHelper.run("reconstruct", directory, "not-a-destination"); output.shouldContain("Filename must end with .jfr"); output = ExecuteHelper.run("reconstruct", "--wrongOption", directory, destination); output.shouldContain("Too many arguments"); FileWriter fw = new FileWriter(destination); fw.write('d'); fw.close(); output = ExecuteHelper.run("reconstruct", directory, destination); output.shouldContain("already exists"); Files.delete(destinationPath); // test success output = ExecuteHelper.run("reconstruct", directory, destination); System.out.println(output.getOutput()); output.shouldContain("Reconstruction complete"); long reconstructedCount = countEventInRecording(destinationPath); Asserts.assertEquals(expectedCount, reconstructedCount); // Cleanup for (int i = 0; i < RECORDING_COUNT; i++) { recordings[i].close(); } }
Example #6
Source File: DCmdConfigure.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private void printRepositoryPath() { print("Repository path: "); printPath(Repository.getRepository().getRepositoryPath()); println(); }
Example #7
Source File: TestAssemble.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("resource") public static void main(String[] args) throws Throwable { // Create some disk recordings Recording[] recordings = new Recording[5]; for (int i = 0; i < RECORDING_COUNT; i++) { Recording r = new Recording(); r.setToDisk(true); r.start(); CorrelationEvent ce = new CorrelationEvent(); ce.id = i; ce.commit(); r.stop(); recordings[i] = r; } Path dir = Paths.get("reconstruction-parts"); Files.createDirectories(dir); long expectedCount = 0; for (int i = 0; i < RECORDING_COUNT; i++) { Path tmp = dir.resolve("chunk-part-" + i + ".jfr"); recordings[i].dump(tmp); expectedCount += countEventInRecording(tmp); } SafePath repository = Repository.getRepository().getRepositoryPath(); Path destinationPath = Paths.get("reconstructed.jfr"); String directory = repository.toString(); String destination = destinationPath.toAbsolutePath().toString(); // Test failure OutputAnalyzer output = ExecuteHelper.jfr("assemble"); output.shouldContain("too few arguments"); output = ExecuteHelper.jfr("assemble", directory); output.shouldContain("too few arguments"); output = ExecuteHelper.jfr("assemble", "not-a-directory", destination); output.shouldContain("directory does not exist, not-a-directory"); output = ExecuteHelper.jfr("assemble", directory, "not-a-destination"); output.shouldContain("filename must end with '.jfr'"); output = ExecuteHelper.jfr("assemble", "--wrongOption", directory, destination); output.shouldContain("too many arguments"); FileWriter fw = new FileWriter(destination); fw.write('d'); fw.close(); output = ExecuteHelper.jfr("assemble", directory, destination); output.shouldContain("already exists"); Files.delete(destinationPath); // test success output = ExecuteHelper.jfr("assemble", directory, destination); System.out.println(output.getOutput()); output.shouldContain("Finished."); long reconstructedCount = countEventInRecording(destinationPath); Asserts.assertEquals(expectedCount, reconstructedCount); // Cleanup for (int i = 0; i < RECORDING_COUNT; i++) { recordings[i].close(); } }
Example #8
Source File: DCmdConfigure.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void printRepositoryPath() { print("Repository path: "); printPath(Repository.getRepository().getRepositoryPath()); println(); }
Example #9
Source File: TestAssemble.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("resource") public static void main(String[] args) throws Throwable { // Create some disk recordings Recording[] recordings = new Recording[5]; for (int i = 0; i < RECORDING_COUNT; i++) { Recording r = new Recording(); r.setToDisk(true); r.start(); CorrelationEvent ce = new CorrelationEvent(); ce.id = i; ce.commit(); r.stop(); recordings[i] = r; } Path dir = Paths.get("reconstruction-parts"); Files.createDirectories(dir); long expectedCount = 0; for (int i = 0; i < RECORDING_COUNT; i++) { Path tmp = dir.resolve("chunk-part-" + i + ".jfr"); recordings[i].dump(tmp); expectedCount += countEventInRecording(tmp); } SafePath repository = Repository.getRepository().getRepositoryPath(); Path destinationPath = Paths.get("reconstructed.jfr"); String directory = repository.toString(); String destination = destinationPath.toAbsolutePath().toString(); // Test failure OutputAnalyzer output = ExecuteHelper.jfr("assemble"); output.shouldContain("too few arguments"); output = ExecuteHelper.jfr("assemble", directory); output.shouldContain("too few arguments"); output = ExecuteHelper.jfr("assemble", "not-a-directory", destination); output.shouldContain("directory does not exist, not-a-directory"); output = ExecuteHelper.jfr("assemble", directory, "not-a-destination"); output.shouldContain("filename must end with '.jfr'"); output = ExecuteHelper.jfr("assemble", "--wrongOption", directory, destination); output.shouldContain("too many arguments"); FileWriter fw = new FileWriter(destination); fw.write('d'); fw.close(); output = ExecuteHelper.jfr("assemble", directory, destination); output.shouldContain("already exists"); Files.delete(destinationPath); // test success output = ExecuteHelper.jfr("assemble", directory, destination); System.out.println(output.getOutput()); output.shouldContain("Finished."); long reconstructedCount = countEventInRecording(destinationPath); Asserts.assertEquals(expectedCount, reconstructedCount); // Cleanup for (int i = 0; i < RECORDING_COUNT; i++) { recordings[i].close(); } }