RFR: 8311639: Replace currentTimeMillis() with nanoTime() in jtreg/gc
Leo Korinth
lkorinth at openjdk.org
Thu Aug 17 16:03:42 UTC 2023
I have removed usage of `currentTimeMillis()` in jtreg/gc as `currentTimeMillis()` is not monotonic. It is mostly changing from milliseconds to nanoseconds. In certain places, I have changed the code from something like `(instant1 < instant2)` to `(instant1 - instant2 < 0)` It might look like I am removing instant2 from both sides of the inequality and the result ought to be the same, but due to overflow arithmetic, the change should be better if nanoseconds where to overflow. I have also removed some loops where the loop is doing nothing except sleeping. I somewhat shortened the string in the key of a hash map because the nanosecond value made the string too long for the heap size.
All tests within jtreg/gc passes.
-------------
Commit messages:
- 8311639: Replace currentTimeMillis() with nanoTime() in jtreg/gc
Changes: https://git.openjdk.org/jdk/pull/15331/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15331&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8311639
Stats: 128 lines in 17 files changed: 2 ins; 15 del; 111 mod
Patch: https://git.openjdk.org/jdk/pull/15331.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15331/head:pull/15331
PR: https://git.openjdk.org/jdk/pull/15331
More information about the hotspot-gc-dev
mailing list