Skip to content

8365919: Replace currentTimeMillis with nanoTime in Stresser.java #26879

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

albertnetymk
Copy link
Member

@albertnetymk albertnetymk commented Aug 21, 2025

Mostly a mechanic change from currentTimeMillis() to nanoTime()/1000000. It also removes finishTime to avoid overflowing.

The change in iteration() is to ensure currentTime is properly initialized.

(Was investigating a timeout on Windows-x64, which led me to this code. I think this fix is good enough by its own.)

Test: tier1-5


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-8365919: Replace currentTimeMillis with nanoTime in Stresser.java (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26879

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 21, 2025

👋 Welcome back ayang! 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 Aug 21, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title JDK-8365919 8365919: Replace currentTimeMillis with nanoTime in Stresser.java Aug 21, 2025
@openjdk
Copy link

openjdk bot commented Aug 21, 2025

@albertnetymk To determine the appropriate audience for reviewing this pull request, one or more labels corresponding to different subsystems will normally be applied automatically. However, no automatic labelling rule matches the changes in this pull request. In order to have an "RFR" email sent to the correct mailing list, you will need to add one or more applicable labels manually using the /label pull request command.

Applicable Labels
  • build
  • client
  • compiler
  • core-libs
  • graal
  • hotspot
  • hotspot-compiler
  • hotspot-gc
  • hotspot-jfr
  • hotspot-runtime
  • i18n
  • ide-support
  • javadoc
  • jdk
  • jmx
  • net
  • nio
  • security
  • serviceability
  • shenandoah

@albertnetymk
Copy link
Member Author

/cc hotspot-gc

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

openjdk bot commented Aug 21, 2025

@albertnetymk
The hotspot-gc label was successfully added.

@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 21, 2025
@mlbridge
Copy link

mlbridge bot commented Aug 21, 2025

Webrevs

Copy link
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

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

You might want to load (options.getTime() * 1000) into a local rather than compute it multiple times.

@albertnetymk
Copy link
Member Author

You might want to load (options.getTime() * 1000) into a local rather than compute it multiple times.

Extracted that to a local var for getTimeLeft. I skipped printExecutionInfo, as I feel introducing a local var there actually makes it a bit harder to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc hotspot-gc-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants