llllb
llllb

Reputation: 21

How to identify JFR event types

I know of three JFR Event types: Instant Event, Duration Event, and Sample Event, but how to identify JFR event types. I try to distinguish them from the configuration, but it seems doesn't work, for example, jdk.ObjectAllocationInNewTLAB, it only need to configure whether to enable, seems to be an Instant Event, but is actually a Sample of the Event.

This is important to me because I want to analyze with full information, not samples

Upvotes: 1

Views: 304

Answers (1)

Kire Haglin
Kire Haglin

Reputation: 7069

You can see what options an event type supports by using the setting descriptor:

for(EventType type : FlightRecorder.getFlightRecorder().getEventTypes()) {
  System.out.println(type.getName());
  System.out.println("Settings:");
  for (SettingDescriptor s : type.getSettingDescriptors()) {
    String def = " (default: " + s.getDefaultValue() + ")";
    System.out.println("  " + s.getName() + def);
  }
  System.out.println();
}

It's also possible to list event metadata, including settings, using the 'jfr' tool located in JAVA_HOME/bin. For JDK 11, you must supply the file you want metadata to be printed for:

$ jfr metadata recording.jfr

For JDK 17, you can omit the file and you will get the event types for the JDK the tool is located in:

$ jfr metadata 

Upvotes: 1

Related Questions