-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8326446: The User and System of jdk.CPULoad on Apple M1 are inaccurate #17976
Conversation
👋 Welcome back yanglong1010! A progress list of the required criteria for merging this PR into |
@yanglong1010 The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
/label add hotspot-jfr |
@yanglong1010 |
Seems reasonable. Is there a risk of introducing a regression for existing platforms? Did the result on x64 turn out equivalent to pre-change? |
The units are changed from nanos to ticks, but this is opaque because doubles are used to represent only the ratios? |
Yes |
I ran the pre- and post-change versions on MacOS X64, and I can see that the results are consistent. The test will occupy half of the CPUs, so the sum of User and System is close to 50%. There are other processes on the host that occupy the CPUs, so the utilization rate of MachineTotal is higher than 50%.
|
Thank you for confirming. |
|
@yanglong1010 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 160 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@mgronlun, @egahlin) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@yanglong1010 |
@mgronlun Thanks for your review. Does this patch need a second review ? |
I think it needs a second review. Also, I am not very versed in Mac internals. |
Thanks. Would you help me to invite the second reviewer? |
@egahlin Could I have a second review of this patch. |
Looks reasonable, but why was this removed:
|
Because the times libc api returns the real time of the process. So we don't need to calculate the
|
OK, I had a vague memory about some other issue, but I don't remember and it probably doesn't apply. |
/sponsor |
Going to push as commit 8dbd4b3.
Your commit was automatically rebased without conflicts. |
@D-D-H @yanglong1010 Pushed as commit 8dbd4b3. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Thank you all. |
/backport jdk21u-dev |
@yanglong1010 To use the |
hi
I would like to fix this.
As the description in JDK-8326446.
JFR uses task_info() with flavor TASK_ABSOLUTETIME_INFO to read User and System time. it is not reliable on Apple m1.
Libc provides the times 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.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17976/head:pull/17976
$ git checkout pull/17976
Update a local copy of the PR:
$ git checkout pull/17976
$ git pull https://git.openjdk.org/jdk.git pull/17976/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17976
View PR using the GUI difftool:
$ git pr show -t 17976
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17976.diff
Webrev
Link to Webrev Comment