Skip to content

8241678: Remove PerfData sampling via StatSampler #24872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

caspernorrbin
Copy link
Member

@caspernorrbin caspernorrbin commented Apr 25, 2025

Hi everyone,

This change removes the legacy PerfData sampling mechanism implemented through the StatSampler — an always-on periodic task that runs every 50ms my default. The sampling feature was originally introduced to collect performance counters and timestamps, but has since seen very little use.

For G1/ZGC, the only sampled value is a timestamp (sun.os.hrt.ticks). For Serial/Parallel, it also samples some heap space counters, but these are already updated after each GC cycle, making the sampling redundant. With sampling removed, the PerfDataSamplingInterval flag becomes obsoleted, as it no longer serves any purpose.

The only thing relying on the sampled timestamps is jstat: running jstat -t prints an extra column with the time since VM start. To preserve this funcitonality, we can calculate the timestamps as an offset from the already existing sun.rt.createVmBeginTime instead.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Change requires CSR request JDK-8241701 to be approved
  • Commit message must refer to an issue

Issues

  • JDK-8241678: Remove PerfData sampling via StatSampler (Enhancement - P4)
  • JDK-8241701: Remove PerfData sampling via StatSampler (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24872

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 25, 2025

👋 Welcome back cnorrbin! 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 Apr 25, 2025

@caspernorrbin 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:

8241678: Remove PerfData sampling via StatSampler

Reviewed-by: jsjolen, ayang

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

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@albertnetymk, @jdksjolen) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot changed the title 8241678 8241678: Remove PerfData sampling via StatSampler Apr 25, 2025
@openjdk openjdk bot added csr Pull request needs approved CSR before integration rfr Pull request is ready for review labels Apr 25, 2025
@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@caspernorrbin The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

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

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Apr 25, 2025
@albertnetymk
Copy link
Member

/cc hotspot-gc

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Apr 25, 2025
@openjdk
Copy link

openjdk bot commented Apr 25, 2025

@albertnetymk
The hotspot-gc label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Apr 25, 2025

Webrevs

Copy link
Member

@albertnetymk albertnetymk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still a few matches for "hrt.ticks"; don't know if they should be removed (in this PR or a followup).

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Apr 29, 2025
@caspernorrbin
Copy link
Member Author

Thank you for reviewing @albertnetymk! I'll look into the last traces of "hrt.ticks" to see if they can be removed here.

Copy link
Member

@albertnetymk albertnetymk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed only hotspot changes. Not familiar with other parts.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 29, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label May 13, 2025
Copy link
Contributor

@jdksjolen jdksjolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this looks good to me.

It seems like there's no user-visible change, except the removal of the global variable. Is that correct?

@openjdk
Copy link

openjdk bot commented May 21, 2025

@caspernorrbin this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout statsampler-removal
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label May 21, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label May 22, 2025
@caspernorrbin
Copy link
Member Author

It seems like there's no user-visible change, except the removal of the global variable. Is that correct?

Besides the global variable, there's a slight change in the behaviour of the perfdata-counters for Serial/Parallel, as mentioned in the PR. The JBS issue has a clarifying comment explaining why this shouldn't have any meaningful impact.

@kevinjwalls
Copy link
Contributor

Hi, looks good.
If we are removing things from jcmd PerfCounter.print output, that could feature in the release note that you have planned. Anybody expecting these counters using jcmd PerfCounter.print or other methods, may not know that they are related to StatSampler and would not realise from the title that this is a relevant change.

$ jcmd 203133 PerfCounter.print | grep hrt
sun.os.hrt.frequency=1000000000
sun.os.hrt.ticks=132389861230

@caspernorrbin
Copy link
Member Author

Hi, looks good.
If we are removing things from jcmd PerfCounter.print output, that could feature in the release note that you have planned. Anybody expecting these counters using jcmd PerfCounter.print or other methods, may not know that they are related to StatSampler and would not realise from the title that this is a relevant change.

Thank you. I will add that to the release note, along with text on how to calculate it instead using offsets (similar to what I did with the jstat counter)

Copy link
Contributor

@jdksjolen jdksjolen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review, @kevinjwalls. Let's integrate it :-).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 28, 2025
@caspernorrbin
Copy link
Member Author

Thank you everyone for the reviews!

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label May 28, 2025
@openjdk
Copy link

openjdk bot commented May 28, 2025

@caspernorrbin
Your change (at version e976ea6) is now ready to be sponsored by a Committer.

@albertnetymk
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented May 28, 2025

Going to push as commit 6ebae6c.
Since your change was applied there have been 95 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 May 28, 2025
@openjdk openjdk bot closed this May 28, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels May 28, 2025
@openjdk
Copy link

openjdk bot commented May 28, 2025

@albertnetymk @caspernorrbin Pushed as commit 6ebae6c.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

4 participants