RFR: 8356968: JFR: Compilation event should be enabled for all compilations by default

Erik Gahlin egahlin at openjdk.org
Wed Aug 27 16:02:51 UTC 2025


On Thu, 15 May 2025 08:49:47 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> In the field, we are using -XX:+PrintCompilation to track compiler performance. Alternatively, -Xlog:jit* prints the same. JFR has a the related jdk.Compilation event that gives us even richer diagnostics. Yet, that event is set at a very high threshold (1000ms), which skips almost all compilations! This threshold is set to such a high value from the beginning. 
> 
> It is fairly normal to have lots of compilations in 100+ ms range individually, and their sum impact is what we are after. Also, the compilations are normally quite rare, and there are a couple of thousands of compiles in most workloads, and they only happen sporadically. This means, the event count without any threshold is not high.
> 
> Therefore, it would be convenient to make sure that basic Compilation event is enabled unconditionally, e.g. by dropping the default threshold to 0.
> 
> See more logs in the bug itself.
> 
> Additional testing:
>  - [x] Ad-hoc tests with printing compilation events
>  - [x] Linux x86_64 server fastdebug, `jdk_jfr`

`jfr summary` doesn't show the full cost of an event. The jdk.CheckPoint event also constains information about methods, classes and class loaders that the jdk.Compilation events hold references to. If you want to see the full cost:

    $ java -Xcomp -XX:StartFlightRecording:jdk.Compilation#threshold=0ns,filename=recording.jfr
      -jar ./build/platform/images/jdk/demo/jfc/J2Ddemo/J2Ddemo.jar`
    $ jfr scrub recording.jfr waste-free.jfr
    $ jfr scrub --exclude-events jdk.Compilation waste-free.jfr no-compilation.jfr
    $ ls -l waste-free.jfr no-compilation.jfr
    -rw-r--r--  1 -----  -----  2054496 Aug 27 17:29 waste-free.jfr
    -rw-r--r--  1 -----  -----   895963 Aug 27 17:32 no-compilation.jfr

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25247#issuecomment-3228797895


More information about the hotspot-jfr-dev mailing list