RFR: 8274051: Remove supports_vtime()/elapsedVTime()

Thomas Schatzl tschatzl at openjdk.org
Thu Jun 26 16:06:07 UTC 2025


Hi all,

  please review this change that removes the `*vtime()` methods from G1, replacing them with the appropriate `os::thread_cpu_time()` calls. They completely supersede the former ones.

Further I made support for `os::thread_cpu_time()` mandatory for G1, it will fail if not available. All platforms implement them, only non-OSX *BSD do not in mainline sources. However in the [official fork](https://github.com/freebsd/openjdk/blob/jdk24u-freebsd/src/hotspot/os/bsd/os_bsd.cpp#L2609) it already does.

There are upstreaming efforts underway too, so I do not see this as blocker for this behavior. 

One other change is that the various getters directly use the time returned by the OS function as cpu time, only counting the main work (marking steps, actual refinement) as used cpu time. I do not think this is honest to discount random cpu time spent in other work these threads must do (like getting to and leaving the main work described above).

There has been some effort to make naming a bit more consistent: cpu times were all named with `_cpu_time` with all non-standard units that unit appended (`_s`for seconds and so on).

Testing: tier1-3

Thanks,
  Thomas

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

Commit messages:
 - * whitespace removal
 - * renamings
 - * fix build
 - * initial version

Changes: https://git.openjdk.org/jdk/pull/26001/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26001&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8274051
  Stats: 188 lines in 18 files changed: 29 ins; 96 del; 63 mod
  Patch: https://git.openjdk.org/jdk/pull/26001.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26001/head:pull/26001

PR: https://git.openjdk.org/jdk/pull/26001


More information about the hotspot-gc-dev mailing list