Created
July 19, 2021 13:08
-
-
Save shelajev/1be3c6f5b63278634958070c7292df92 to your computer and use it in GitHub Desktop.
Example of using a JFR event from Java code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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