RFR: 8369692: JFR: Don't record thread metadata in case jdk.ThreadStart is disabled
Kerem Kat
krk at openjdk.org
Tue Nov 11 16:53:03 UTC 2025
On Mon, 10 Nov 2025 18:52:31 GMT, Kerem Kat <krk at openjdk.org> wrote:
> ### Before
> File size: 0.84 MB
> Scrubbed size: 0.82 MB
> Waste: 2.73%
>
> ### After
> File size: 0.80 MB
> Scrubbed size: 0.78 MB
> Waste: 3.40%
>
> File size decreases when `ThreadStart` and `ThreadEnd` events are disabled.
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?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28222#issuecomment-3517837507
More information about the hotspot-jfr-dev
mailing list