mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 01:19:28 +01:00
8365815: JFR: Update metadata.xml with 'jfr query' examples
Reviewed-by: mgronlun
This commit is contained in:
@@ -922,8 +922,10 @@ public class GenerateJfrFiles {
|
||||
}
|
||||
out.write(" using JfrEvent<Event" + event.name
|
||||
+ ">::commit; // else commit() is hidden by overloaded versions in this class");
|
||||
printConstructor2(out, event, empty);
|
||||
printCommitMethod(out, event, empty);
|
||||
if (!event.fields.isEmpty()) {
|
||||
printConstructor2(out, event, empty);
|
||||
printCommitMethod(out, event, empty);
|
||||
}
|
||||
if (!empty) {
|
||||
printVerify(out, event.fields);
|
||||
}
|
||||
|
||||
@@ -40,16 +40,39 @@
|
||||
event.commit();
|
||||
}
|
||||
|
||||
void baz(char* text) {
|
||||
EventText event;
|
||||
event.set_text(text);
|
||||
event.commit();
|
||||
}
|
||||
|
||||
$ make images
|
||||
$ 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:
|
||||
try (var rf = new RecordingFile(Path.of("dump.jfr"))) {
|
||||
while (rf.hasMoreEvents()) {
|
||||
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"));
|
||||
}
|
||||
};
|
||||
!-->
|
||||
|
||||
Reference in New Issue
Block a user