RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v48]
Andrei Pangin
apangin at openjdk.org
Wed Jun 4 12:38:21 UTC 2025
On Wed, 4 Jun 2025 12:10:17 GMT, Johannes Bechberger <jbechberger at openjdk.org> wrote:
>> This is the code for the [JEP 509: CPU Time based profiling for JFR](https://openjdk.org/jeps/509).
>>
>> Currently tested using [this test suite](https://github.com/parttimenerd/basic-profiler-tests). This runs profiles the [Renaissance](https://renaissance.dev/) benchmark with
>> - ... different heap sizes
>> - ... different GCs
>> - ... different samplers (the standard JFR and the new CPU Time Sampler and both)
>> - ... different JFR recording durations
>> - ... different chunk-sizes
>
> Johannes Bechberger has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix timer creation warning
src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 491:
> 489:
> 490: void JfrCPUTimeThreadSampling::handle_timer_signal(siginfo_t* info, void* context) {
> 491: if (info->si_code != SIGPROF) {
The correct check is
`if (info->si_code != SI_TIMER)`
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`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126447823
PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2126488937
More information about the serviceability-dev
mailing list