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

Johannes Bechberger jbechberger at openjdk.org
Wed Jun 4 14:27:16 UTC 2025


On Wed, 4 Jun 2025 13:55:06 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:

>> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix build
>
> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 330:
> 
>> 328: void JfrCPUSamplerThread::stackwalk_threads_in_native() {
>> 329:   ResourceMark rm;
>> 330:   MutexLocker tlock(Threads_lock);
> 
> What exactly are we guarding against by holding the `Threads_lock`? Seems `ThreadsListHandle` should be enough.

You're right.

> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 584:
> 
>> 582:   sev.sigev_notify = SIGEV_THREAD_ID;
>> 583:   sev.sigev_signo = SIG;
>> 584:   sev.sigev_value.sival_ptr = &t;
> 
> Why setting the address of `t` which is a local variable here?

Because this is how the API works. You store the location where the timer should be stored.

See https://www.man7.org/linux/man-pages/man2/timer_create.2.html for more information.

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

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


More information about the serviceability-dev mailing list