Module jdk.jfr
Package jdk.jfr

Class Recording

java.lang.Object
jdk.jfr.Recording
All Implemented Interfaces:
Closeable, AutoCloseable

public final class Recording extends Object implements Closeable
Provides means to configure, start, stop and dump recording data to disk.

The following example shows how configure, start, stop and dump recording data to disk.

Configuration c = Configuration.getConfiguration("default");
try (Recording r = new Recording(c)) {
    r.start();
    System.gc();
    Thread.sleep(5000);
    r.stop();
    r.dump(Files.createTempFile("my-recording", ".jfr"));
}
Since:
9