RFR: 8358750: JFR: EventInstrumentation MASK_THROTTLE* constants should be computed in longs [v2]
Erik Gahlin
egahlin at openjdk.org
Tue Jul 1 08:12:54 UTC 2025
> Could I have a review of a fix to the throttling mechanism added in JDK 25? Long values should be shifted instead of integer values when creating the masks.
>
> During debugging, I found several issues, and I also strengthened the test.
>
> - The start time of the event needs to be stored if the event is being throttled. The reason is that the timestamp is reused later to determine if the event should be throttled or not. This happens with events that lack an end time.
>
> - The duration value that is written to the buffer must remove the mask if it is throttled. This is handled by`getDuration(blockCodeBuilder)`.
>
> - I added a clarifying comment that when duration is compared to 0, it also prevents a new duration from being calculated if the event has been throttled (for an instant event).
>
> The test now checks that the duration is not negative, that the start time is not before the test starts, and that the duration is not unreasonably large. The reason I multiply the recording duration by two is to give the test some slack in case we run into clock issues where the time taken for the event doesn't match the recording. Purpose of the check is to make sure we don't end up with the mask being added to the duration.
>
> Testing:
> test/jdk/jdk/jfr + tier1
>
> I validated manually that the throttle rate works using a small test program I have (which can't be checked in due to stability issues).
Erik Gahlin has updated the pull request incrementally with one additional commit since the last revision:
Remove whitespace
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/26028/files
- new: https://git.openjdk.org/jdk/pull/26028/files/214c9397..9d397d90
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=26028&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=26028&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/26028.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26028/head:pull/26028
PR: https://git.openjdk.org/jdk/pull/26028
More information about the hotspot-jfr-dev
mailing list