RFR: 8351999: JFR: Incorrect scaling of throttled values
Erik Gahlin
egahlin at openjdk.org
Fri Mar 14 16:29:54 UTC 2025
On Fri, 14 Mar 2025 12:16:40 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Could I have a review of a PR that fixes an incorrect scaling of samples for the ThrottleSetting.
>>
>> Testing: jdk/jdk/jfr
>>
>> Thanks
>> Erik
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/settings/ThrottleSetting.java line 97:
>
>> 95: if (unit.nanos < SECONDS.nanos) {
>> 96: long perSecond = SECONDS.nanos / unit.nanos;
>> 97: samples = Utils.multiplyOverflow(samples, perSecond, Long.MAX_VALUE);
>
> Reasoning from the math alone, it looks obvious that `samples *= samples` is not correct. So that part looks fine.
>
> Thinking about `unit.nanos == SECONDS.nanos` case. This means the unit is exactly "seconds", so no adjustment is needed?
Native expects the value in milliseconds, and the default value is 1000 ms, so it seems fine to me.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24045#discussion_r1995881185
More information about the hotspot-jfr-dev
mailing list