RFR: 8359110: Log accumulated GC and process CPU time upon VM exit [v12]
Thomas Schatzl
tschatzl at openjdk.org
Wed Jul 2 08:50:52 UTC 2025
On Wed, 2 Jul 2025 07:22:54 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> It is not required, but I was conforming to the same type as the methods that was removed in JDK-8274051 and as well as `elapsedTime()`. `elapsedTime()` returns the wall-clock time in seconds since start in `double`.
>
> I don't see how there is a loss of precision here, just because the unit ahead of the decimal point is seconds.
>
> 2.123456789 seconds still has nanosecond precision
Instead of adding integer nanosecond values together to form a final sum and then divide just when printing the value, the code divides each part of the sum and then add them together. The FP division is lossy due to (very minor) representation issues too.
Also performs unnecessary relatively costly FP operations.
Very negligible nowadays, but why incur these problems for no reason? There does not seem to be an advantage to keep intermediate values as doubles in seconds.
It's far from a blocker from me, in fact I already signed this off.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25779#discussion_r2179489841
More information about the hotspot-gc-dev
mailing list