mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8365815: JFR: Update metadata.xml with 'jfr query' examples
Reviewed-by: mgronlun
This commit is contained in:
parent
45726a1f8b
commit
d24449f696
@ -922,8 +922,10 @@ public class GenerateJfrFiles {
|
|||||||
}
|
}
|
||||||
out.write(" using JfrEvent<Event" + event.name
|
out.write(" using JfrEvent<Event" + event.name
|
||||||
+ ">::commit; // else commit() is hidden by overloaded versions in this class");
|
+ ">::commit; // else commit() is hidden by overloaded versions in this class");
|
||||||
printConstructor2(out, event, empty);
|
if (!event.fields.isEmpty()) {
|
||||||
printCommitMethod(out, event, empty);
|
printConstructor2(out, event, empty);
|
||||||
|
printCommitMethod(out, event, empty);
|
||||||
|
}
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
printVerify(out, event.fields);
|
printVerify(out, event.fields);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,16 +40,39 @@
|
|||||||
event.commit();
|
event.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void baz(char* text) {
|
||||||
|
EventText event;
|
||||||
|
event.set_text(text);
|
||||||
|
event.commit();
|
||||||
|
}
|
||||||
|
|
||||||
$ make images
|
$ make images
|
||||||
$ java -XX:StartFlightRecording:settings=none,filename=dump.jfr ...
|
$ java -XX:StartFlightRecording:settings=none,filename=dump.jfr ...
|
||||||
|
$ jfr view Text dump.jfr
|
||||||
|
Time Event Thread Text
|
||||||
|
======== ======================================== ==========================
|
||||||
|
21:54:29 Attach Listener hello
|
||||||
|
21:54:29 Attach Listener world
|
||||||
...
|
...
|
||||||
$ jfr print dump.jfr
|
$ jfr query 'SELECT text, COUNT(text) FROM Text GROUP BY text ORDER BY text ASC' dump.jfr
|
||||||
|
|
||||||
|
Text Count
|
||||||
|
=================== ===================
|
||||||
|
hello 622
|
||||||
|
world 37
|
||||||
|
|
||||||
|
$ jfr query 'SELECT COUNT(duration), AVG(duration), MEDIAN(duration), P90(duration),
|
||||||
|
P99(duration), P999(duration) FROM Duration' dump.jfr
|
||||||
|
|
||||||
|
The 'jfr query' command is only available in debug builds, but recordings with internal
|
||||||
|
events can be generated by product builds.
|
||||||
|
|
||||||
Programmatic access:
|
Programmatic access:
|
||||||
try (var rf = new RecordingFile(Path.of("dump.jfr"))) {
|
try (var rf = new RecordingFile(Path.of("dump.jfr"))) {
|
||||||
while (rf.hasMoreEvents()) {
|
while (rf.hasMoreEvents()) {
|
||||||
RecordedEvent e = rf.readEvent();
|
RecordedEvent e = rf.readEvent();
|
||||||
System.out.println(e.getName() + " " + e.getDuration());
|
EventType et = e.getEventType();
|
||||||
|
System.out.println(et.getName() + " " + e.getDuration() + " " + e.getValue("text"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
!-->
|
!-->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user