RFR: 8358750: JFR: EventInstrumentation MASK_THROTTLE* constants should be computed in longs [v2]

Markus Grönlund mgronlun at openjdk.org
Thu Jul 3 12:37:43 UTC 2025


On Tue, 1 Jul 2025 08:12:54 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

>> 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

Marked as reviewed by mgronlun (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/26028#pullrequestreview-2982995446


More information about the hotspot-jfr-dev mailing list