RFR: 8326446: The User and System of jdk.CPULoad on Apple M1 are inaccurate

Long Yang duke at openjdk.org
Fri Feb 23 07:54:14 UTC 2024


hi

I would like to fix this.

As the description in [JDK-8326446](https://bugs.openjdk.org/browse/JDK-8326446).
JFR uses task_info() with flavor TASK_ABSOLUTETIME_INFO to read User and System time is not reliable on Apple m1.

Libc provides the [times](https://man7.org/linux/man-pages/man2/times.2.html) function, which uses TASK_BASIC_INFO_COUNT and TASK_THREAD_TIMES_INFO_COUNT. It will also return the real time of the process, and the time unit is the same, which is suitable for solving this problem.

I ran test/jdk/jdk/jfr/event/os/TestCPULoad.java and passed.

I would appreciate it if you could review this.

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

Commit messages:
 - 8326446: The User and System of jdk.CPULoad on Apple M1 are inaccurate

Changes: https://git.openjdk.org/jdk/pull/17976/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17976&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8326446
  Stats: 29 lines in 1 file changed: 1 ins; 7 del; 21 mod
  Patch: https://git.openjdk.org/jdk/pull/17976.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17976/head:pull/17976

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


More information about the hotspot-runtime-dev mailing list