-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSample_01_Hello_World.java
More file actions
39 lines (36 loc) · 967 Bytes
/
Sample_01_Hello_World.java
File metadata and controls
39 lines (36 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import jdk.jfr.Event;
import jdk.jfr.Label;
import jdk.jfr.Name;
// Description
// -----------
//
// The sample shows how to create an event, start a recording on command line
// and print the event to standard out.
//
// The Label annotation provides a human-readable name and the Name annotation
// provides a symbolic name that can be used to identify the event.
//
// A stable and easy to use symbolic name is usually on the form:
//
// [org|com|net].[organization|product].EventName
//
// How to run
// ----------
//
// $ java -XX:StartFlightRecording:filename=01.jfr Sample_01_Hello_World.java
// $ jfr print --events HelloWorld 01.jfr
//
//
public class Sample_01_Hello_World {
@Name("com.sample.HelloWorld")
@Label("Hello World")
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();
}
}