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

Johannes Bechberger jbechberger at openjdk.org
Wed Jun 4 13:07:15 UTC 2025


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

>> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 652:
>> 
>>> 650: bool JfrCPUSamplerThread::init_timers() {
>>> 651:   // install sig handler for sig
>>> 652:   if ((s8)PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == -1) {
>> 
>> Comparing return value to `(void*)-1` would be cleaner.
>> But the main problem is that it only checks for `sigaction` failure (which normally never happens), however, we should also check if there was a custom signal handler set _before_ installing our own handler, i.e. old handler is not SIG_IGN or SIG_DFL or `handle_timer_signal`.
>
> Using `sigaction(SIG, NULL, &sa)` ?

I'm currently implementing the check against SIG_IGN and SIG_DFL, as `handle_timer_signal` should never occur.

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

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


More information about the hotspot-dev mailing list