jmx-dev RFR: 8269851: OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers [v7]

xpbob github.com+7837910+xpbob at openjdk.java.net
Tue Jul 13 06:03:53 UTC 2021


On Tue, 13 Jul 2021 05:19:25 GMT, xpbob <github.com+7837910+xpbob at openjdk.org> wrote:

>> …ocess cpu usage in containers
>
> xpbob has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Set 1.0 for cpu set max

> > > Thanks for the update. `getProcessCpuLoad()` and `getCpuLoad()` looks way too similar to me. Is there a way to make them more generic and do the process vs. system paths as needed? I think there is.
> > 
> > 
> > use getCpuLoadWithTarget for process and system
> 
> Thanks. We are getting there. I've proposed a PR to your branch which makes this a bit easier to read:
> [xpbob#1](https://github.com/xpbob/jdk/pull/1)
> 
> If you merge that it'll show up in this PR.

Thank you so much @jerboaa .

Code has been merged.
I tested the following cgroup scenario on Linux/x64 and all passed.

  cpu-quota=50000 cpu-period=50000 
  cpuset-cpus=0-2
  cpu.shares=2048
  cpuset-cpus=3

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

PR: https://git.openjdk.java.net/jdk/pull/4702


More information about the jmx-dev mailing list