RFR: 8342818: Implement JEP 509: JFR CPU-Time Profiling [v58]
Andrei Pangin
apangin at openjdk.org
Wed Jun 4 19:15:09 UTC 2025
On Wed, 4 Jun 2025 17:54:50 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:
>
> Improve disenroll
src/hotspot/os/posix/signals_posix.cpp line 1511:
> 1509: struct sigaction oact;
> 1510: if (sigaction(sig, (struct sigaction*)nullptr, &oact) == -1) {
> 1511: return nullptr; // signal not installed
A comment is misleading: sigaction does not fail if a handler for the signal is not installed (i.e. the handler is SIG_IGN).
src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 656:
> 654: if ((prev_handler != SIG_DFL && prev_handler != SIG_IGN && prev_handler != (void*)::handle_timer_signal) ||
> 655: PosixSignals::install_generic_signal_handler(SIG, (void*)::handle_timer_signal) == (void*)-1) {
> 656: log_error(jfr)("CPUTimeSample events will not be recorded: %p", prev_handler);
A message with some random hex address may look cryptic.
Maybe make it a bit more user-friendly? E.g.
Conflicting SIGPROF handler found: %p. CPUTimeSample events will not be recorded
src/hotspot/share/jfr/periodic/sampling/jfrSampleRequest.cpp line 333:
> 331: }
> 332: }
> 333: request._sample_ticks = JfrTicks::now();
For accurate correlation with other events, timestamp of a sample should be taken as early as possible, preferably in the beginning of `JfrCPUSamplerThread::handle_timer_signal`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127222795
PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127266822
PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2127236706
More information about the serviceability-dev
mailing list