RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v45]

Johannes Bechberger jbechberger at openjdk.org
Wed Jun 4 11:43:32 UTC 2025


On Wed, 4 Jun 2025 11:34:44 GMT, Johannes Bechberger <jbechberger at openjdk.org> wrote:

>> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 611:
>> 
>>> 609:   // increment the count of active signal handlers
>>> 610:   u4 old_value = Atomic::fetch_then_add(&_active_signal_handlers, (u4)1, memory_order_acq_rel);
>>> 611:   if ((old_value & STOP_SIGNAL_BIT) != 0) {
>> 
>> Combining stop signal with a counter is nice, you can then use `Atomic::cmpxchg` to avoid incrementing counter when the stop bit is set.
>
> I don't see how `Atomic::cmpxchg` would make the code easier.

With my current code, I avoid having a loop, and in the fast path, I only have one atomic instruction.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126383576


More information about the hotspot-dev mailing list