This is a custom extension for DuckDB to directly read Java Flight Recorder (JFR) files.
Please visit https://ocadaruma.github.io/jfrv/#/jfr-query for the working demo.
JFR format is a de-facto standard for JVM performance profiling which is adopted by various tools, including JDK Flight Recorder, async-profiler.
However, analyzing JFR files is not always easy because of the lack of query capabilities in the existing tools.
This extension provides a way to analyze JFR files with familiar SQL queries powered by DuckDB.
Furthermore, DuckDB can be compiled to WebAssembly and run in the browser, which enables us to visualize JFR data using web technologies.
This project is highly inspired by jfr-analytics
- Download DuckDB binary from the official website
- Download the extension binary from the release page for your platform
- Load the extension then let's play with JFR!
$ /path/to/duckdb -unsigned
D load '/path/to/libduckdb_jfr_extension.so';
D call jfr_attach('/path/to/your.jfr');
D show tables;
┌─────────────────────────────────┐
│ name │
│ varchar │
├─────────────────────────────────┤
│ jdk.ActiveRecording │
│ jdk.ActiveSetting │
│ jdk.CPUInformation │
│ jdk.CPULoad │
│ jdk.ExecutionSample │
...
D select count(*) from "jdk.ExecutionSample";
- Add
com.mayreh.duckdb:duckdb-jfr-jdbc:$VERSION
to your dependencies - Query JFR file through JDBC
import com.mayreh.duckdb_jfr.DuckDBJfrConnection;
DuckDBJfrConnection conn = DuckDBJfrConnection.inMemoryConnection();
conn.attach(Paths.get("/path/to/your.jfr"));
Statement stmt = conn.connection().createStatement();
ResultSet rs = stmt.executeQuery("select count(*) from \"jdk.ExecutionSample\"");
- Install Bear
- Generate
compile_commands.json
bybear -- cargo build
- build.rs has to re-run for generation
- You may need to clean the project or make some change to cpp sources if necessary
- Open the project in CLion