Skip to content

Conversation

egahlin
Copy link
Member

@egahlin egahlin commented Jun 27, 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 bygetDuration(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).


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8358750: JFR: EventInstrumentation MASK_THROTTLE* constants should be computed in longs (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26028/head:pull/26028
$ git checkout pull/26028

Update a local copy of the PR:
$ git checkout pull/26028
$ git pull https://git.openjdk.org/jdk.git pull/26028/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26028

View PR using the GUI difftool:
$ git pr show -t 26028

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26028.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 27, 2025

👋 Welcome back egahlin! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jun 27, 2025

@egahlin This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8358750: JFR: EventInstrumentation MASK_THROTTLE* constants should be computed in longs

Reviewed-by: mgronlun

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 61 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Jun 27, 2025

@egahlin The following label will be automatically applied to this pull request:

  • hotspot-jfr

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@egahlin egahlin marked this pull request as ready for review June 27, 2025 21:43
@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 27, 2025
@mlbridge
Copy link

mlbridge bot commented Jun 27, 2025

Webrevs

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 3, 2025
@egahlin
Copy link
Member Author

egahlin commented Jul 3, 2025

/integrate

@openjdk
Copy link

openjdk bot commented Jul 3, 2025

Going to push as commit 77e69e0.
Since your change was applied there have been 69 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 3, 2025
@openjdk openjdk bot closed this Jul 3, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 3, 2025
@openjdk
Copy link

openjdk bot commented Jul 3, 2025

@egahlin Pushed as commit 77e69e0.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@egahlin
Copy link
Member Author

egahlin commented Jul 4, 2025

/backport :jdk25

@openjdk
Copy link

openjdk bot commented Jul 4, 2025

@egahlin the backport was successfully created on the branch backport-egahlin-77e69e02-jdk25 in my personal fork of openjdk/jdk. To create a pull request with this backport targeting openjdk/jdk:jdk25, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 77e69e02 from the openjdk/jdk repository.

The commit being backported was authored by Erik Gahlin on 3 Jul 2025 and was reviewed by Markus Grönlund.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk:

$ git fetch https://github.com/openjdk-bots/jdk.git backport-egahlin-77e69e02-jdk25:backport-egahlin-77e69e02-jdk25
$ git checkout backport-egahlin-77e69e02-jdk25
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk.git backport-egahlin-77e69e02-jdk25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-jfr [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants