> ThreadMXBean.getThread{Cpu,User}Time is specified to return -1L when invoked 
> with the id of a virtual thread. This isn't so when running with 
> -XX:-VMContinuations (or ports without support for continuations in the VM) 
> as it returns the cpu/user time of the OS thread that that the virtual thread 
> is bound. A small oversight with JDK-8287496, and missed because our unit 
> test only exercises these methods with the id of the "current virtual 
> thread". The code path when the called with the id that is not the current 
> thread is a different code path.
> 
> The change is limited to jmm_GetThreadCpuTimeWithKind.  I didn't change 
> jmm_GetThreadCpuTimesWithKind because it seems to be unused/dead code. I'll 
> create a separate issue to look at that (it doesn't need to be 
> removed/changed for JDK 19).
> 
> The test case for this API is expanded to cover more cases where the current 
> thread is special cased in the implementation.
> 
> JDK 19 is in RDP2 so this change will require additional approval.

Alan Bateman has updated the pull request incrementally with one additional 
commit since the last revision:

  Fix typo in comment

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

Changes:
  - all: https://git.openjdk.org/jdk19/pull/157/files
  - new: https://git.openjdk.org/jdk19/pull/157/files/4c834d39..bc7dd91b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk19&pr=157&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk19&pr=157&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk19/pull/157.diff
  Fetch: git fetch https://git.openjdk.org/jdk19 pull/157/head:pull/157

PR: https://git.openjdk.org/jdk19/pull/157

Reply via email to