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

Markus Grönlund mgronlun at openjdk.org
Sun May 25 20:24:52 UTC 2025


On Fri, 23 May 2025 21:20:39 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 compilation

src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 146:

> 144:   s4 lost_samples = Atomic::load_acquire(&_lost_samples);
> 145:   while (Atomic::cmpxchg(&_lost_samples, lost_samples, 0) != lost_samples) {
> 146:     lost_samples = Atomic::load_acquire(&_lost_samples);

You can save and reuse what cmpxchg returns to you.

src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 169:

> 167: }
> 168: 
> 169: static int64_t compute_sampling_period(double rate);

Why is this fwd declared?

src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 178:

> 176:   double _rate;
> 177:   bool _autoadapt;
> 178:   volatile int64_t _current_sampling_period_ns = -1;

Please initialize all variables in the constructor's initializer list instead of inline in the header file.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2106297053
PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2106297745
PR Review Comment: https://git.openjdk.org/jdk/pull/25302#discussion_r2106298076


More information about the hotspot-jfr-dev mailing list