RFR: 8269851: OperatingSystemMXBean getProcessCpuLoad reports incorrect process cpu usage in containers [v2]

Severin Gehwolf sgehwolf at openjdk.java.net
Wed Jul 7 08:34:47 UTC 2021


On Wed, 7 Jul 2021 07:55:10 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:
> 
>   remove empty line

This patch seems fine in principle, but I don't like the duplication. Right now, `getProcessUsageDividesTotal()` and `getUsageDividesTotal()` look almost the same, but use different fields to set. Perhaps pass a parameter whether or not it's a system/process load request and use the different setters accordingly. Same duplication between `getCpuLoad()` and `getProcessCpuLoad()`. The main difference seems to be how `usageNanos` are being retrieved.

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

Changes requested by sgehwolf (Reviewer).

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


More information about the serviceability-dev mailing list