Skip to content

Instantly share code, notes, and snippets.

@shelajev
Created July 19, 2021 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shelajev/1be3c6f5b63278634958070c7292df92 to your computer and use it in GitHub Desktop.
Save shelajev/1be3c6f5b63278634958070c7292df92 to your computer and use it in GitHub Desktop.
Example of using a JFR event from Java code
import jdk.jfr.Event;
import jdk.jfr.Description;
import jdk.jfr.Label;
public class Example {
@Label("Hello World")
@Description("Helps programmer getting started")
static class HelloWorld extends Event {
@Label("Message")
String message;
}
public static void main(String... args) {
HelloWorld event = new HelloWorld();
event.message = "hello, world!";
event.commit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment