On Thu, 27 May 2021 08:37:11 GMT, Hao Tang <github.com+7947546+tanghaot...@openjdk.org> wrote:
>> I haven't followed yet all of discussions in this review, but I concern this >> PR changes the meaning of `getCpuLoad()`. >> >> `getCpuLoad()` has been based on total time since the start of the >> container, but after this PR, it is based on the ticks in earlier call. Is >> it ok? >> IMHO it can be accepted because it is the same with load average on Linux, >> but I concern we may need CSR because this PR changes behavior. > >> `getCpuLoad()` has been based on total time since the start of the >> container, but after this PR, it is based on the ticks in earlier call. Is >> it ok? >> IMHO it can be accepted because it is the same with load average on Linux, >> but I concern we may need CSR because this PR changes behavior. > > @YaSuenag Thanks for your comment. I can give two reasons for that. > 1. The javadoc of `OperatingSystemMXBean.getCpuLoad` indicates the method > should return "recent cpu usage". > https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java#L156 > 2. The initial (container-unaware) implementation `getCpuLoad0` does reports > recent CPU load, which the container-aware implementation must be consistent. > >> but after this PR, it is based on the ticks in earlier call. Is it ok? > > The result might be too coarse/inaccurate, if the time between two calls is > too long/short. Any comments for that? > @tanghaoth90 @jerboaa Thank you for explanation! Thanks very much for the review! ------------- PR: https://git.openjdk.java.net/jdk/pull/3656