Module jdk.jfr
Package jdk.jfr

Class Configuration

java.lang.Object
jdk.jfr.Configuration

public final class Configuration extends Object
A collection of settings and metadata describing the configuration.

The following example shows how the Configuration class can be used to list available configurations and how to pass a configuration object to a Recording.

public static void main(String... args) throws Exception {
    if (args.length == 0) {
        System.out.println("Configurations:");
        for (Configuration c : Configuration.getConfigurations()) {
            System.out.println("Name: " + c.getName());
            System.out.println("Label: " + c.getLabel());
            System.out.println("Description: " + c.getDescription());
            System.out.println("Provider: " + c.getProvider());
            System.out.println();
        }
    } else {
        String name = args[0];
        Configuration c = Configuration.getConfiguration(name);
        try (Recording r = new Recording(c)) {
            System.out.println("Starting recording with settings:");
            for (Map.Entry<String, String> setting : c.getSettings().entrySet()) {
                System.out.println(setting.getKey() + " = " + setting.getValue());
            }
            r.start();
        }
    }
}
Since:
9