rel:: [[JVM]] # JFR ## Reference - [catalogue of built-in events by JDK version](https://sap.github.io/SapMachine/jfrevents/) - [user-defined events](https://docs.oracle.com/en/java/javase/19/jfapi/event-metadata.html) - [enable and disable events](https://docs.oracle.com/en/java/javase/19/jfapi/enable-and-disable-events.html) - [Continuous Monitoring with JDK Flight Recorder](https://www.youtube.com/watch?v=xrdLLx6YoDM) (youtube, introduction) - [jfr-analytics](https://github.com/moditect/jfr-analytics) ## Configuration - [Creating a JFC Config File](https://inside.java/2022/06/13/sip055/) - Using [[Java Flight Recorder|JFR]] with [[GraalVM]] - [JDK Flight Recorder support for GraalVM Native Image: The journey so far](x-devonthink-item://57D465C6-CAFF-4EEC-A67E-36F7128333FA) ## Spec - [there intentionally isn't one](https://twitter.com/ErikGahlin/status/1495338682651402242) - [best overview is from Gunnar Morling](x-devonthink-item://CA73EE68-F8AE-453C-A200-A38701D7AC38) and his SVG (below) ![[jfr_file_format.svg]] ## Misc ### Tips #### For creating JFR files for testing From JDK19 onwards you can scrub JFR files for smaller test cases ```bash jfr scrub --excluded-events <comma separated list of events to remove from file> ``` #### Testing - use [JfrUnit](https://github.com/moditect/jfrunit) - [example testing loom thread behavior with JFRUnit](https://softwaregarden.dev/en/posts/new-java/loom/misusing-virtual-threads/) #### Live instrumentation ideas - [Is your blocking queue...blocking?](https://readwise.io/reader/shared/01gnx61fa81q9a2pcqkewtszcs) - emitting custom events - dynamic instrumentation with jmc agent - [jfr-analytics](https://github.com/moditect/jfr-analytics)