Module jdk.jfr
Package jdk.jfr

Class EventSettings

java.lang.Object
jdk.jfr.EventSettings

public abstract class EventSettings extends Object
Convenience class for applying event settings to a recording.

An EventSettings object for a recording can be obtained by invoking the Recording.enable(String) method which is configured using method chaining.

The following example shows how to use the EventSettings class.

try (Recording r = new Recording()) {
    r.enable("jdk.CPULoad")
     .withPeriod(Duration.ofSeconds(1));
    r.enable("jdk.FileWrite")
     .withoutStackTrace()
     .withThreshold(Duration.ofNanos(10));
    r.start();
    Thread.sleep(10_000);
    r.stop();
    r.dump(Files.createTempFile("recording", ".jfr"));
}

Since:
9