RFR: 8351999: JFR: Incorrect scaling of throttled values
Aleksey Shipilev
shade at openjdk.org
Fri Mar 14 12:18:57 UTC 2025
On Fri, 14 Mar 2025 01:52:15 GMT, Erik Gahlin <egahlin 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
Marked as reviewed by shade (Reviewer).
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?
-------------
PR Review: https://git.openjdk.org/jdk/pull/24045#pullrequestreview-2685332765
PR Review Comment: https://git.openjdk.org/jdk/pull/24045#discussion_r1995449423
More information about the hotspot-jfr-dev
mailing list