jmx-dev Integrated: 8351359: OperatingSystemMXBean: values from getCpuLoad and getProcessCpuLoad are stale after 24.8 days (Windows)
Kevin Walls
kevinw at openjdk.org
Thu May 8 13:20:58 UTC 2025
On Tue, 6 May 2025 10:20:22 GMT, Kevin Walls <kevinw at openjdk.org> wrote:
> OperatingSystemImpl.c on Windows is limited by its use of clock(), which hits its limit with longer process uptimes.
>
> https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/clock?view=msvc-170
> "maximum clock function return value of 2147483.647 seconds, or about 24.8 days"
>
> The linked alternative, time(), gives 64-bit time but only seconds. In the example code for time(), there is use of _ftime() to retrieve milliseconds.
>
> Update: GetTickCount64() is a better alternative.
This pull request has now been integrated.
Changeset: 900b3ff7
Author: Kevin Walls <kevinw at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/900b3ff7ee933520efe2438fb7c841a4e6a93d17
Stats: 5 lines in 1 file changed: 2 ins; 0 del; 3 mod
8351359: OperatingSystemMXBean: values from getCpuLoad and getProcessCpuLoad are stale after 24.8 days (Windows)
Reviewed-by: amenkov, sspitsyn
-------------
PR: https://git.openjdk.org/jdk/pull/25062
More information about the jmx-dev
mailing list