RFR: 8369692: JFR: Don't record thread metadata in case jdk.ThreadStart is disabled

Markus Grönlund mgronlun at openjdk.org
Tue Nov 11 17:47:08 UTC 2025


On Tue, 11 Nov 2025 16:50:01 GMT, Kerem Kat <krk at openjdk.org> wrote:

> Instead of checking for every event, we could set a flag unconditionally and check on thread start/end.
> 
> What if we add a `volatile bool _has_emitted_events` to `JfrThreadLocal` and:
> 
>     * Set the flag when any event with `T::hasThread` is written (unconditional store)
> 
>     * At thread start/exit: write the checkpoint if `EventThreadStart/End::is_enabled() || has_emitted_events()`
> 
>     * Clear the flag after writing checkpoint
> 
> 
> What do you think?

The checkpoint must be in place before a T::hasThread event is written.

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

PR Comment: https://git.openjdk.org/jdk/pull/28222#issuecomment-3518045541


More information about the hotspot-jfr-dev mailing list