RFR: 8364532: G1: In liveness tracing, print more significant digits for the liveness value [v3]
Thomas Schatzl
tschatzl at openjdk.org
Thu Aug 7 09:04:17 UTC 2025
On Wed, 6 Aug 2025 11:55:47 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> Thomas Schatzl has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:
>>
>> - Merge branch 'master' into 8364532-liveness-significant-digits
>> - Merge branch '8364531-factor-out-liveness-code' into 8364532-liveness-significant-digits
>> - * use one line per parameter in log message
>> - * rename liveness() method to more accurate liveness_percent()
>> - 8364532
>>
>> Hi all,
>>
>> please review this small change that adds some more significant digits (3 in total) for the "liveness" column in collection set group logging
>>
>> Testing: manual testing
>>
>> Thanks,
>> Thomas
>> - 8364531
>>
>> Hi all,
>>
>> please review this refactoring, eliminating some copy&paste, in cset candidate group liveness logging.
>>
>> The output is mostly the same, except for the young cset group, where the "-" has been replaced to just print the default value (0.0) for efficiency. I did not see this important to have, the gc efficiency for young gen isn't interesting.
>>
>> Testing: local compilation, gha, visual inspection of output
>>
>> Thanks,
>> Thomas
>
> src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 2984:
>
>> 2982: #define G1PPRL_LEN_H_FORMAT " %14s"
>> 2983: #define G1PPRL_GID_GCEFF_FORMAT " %14.1f"
>> 2984: #define G1PPRL_GID_LIVENESS_FORMAT " %#.3g"
>
> Why requiring 3 sig digit in total? This can make it hard to parse, even `1.23e-03` can appear. Is `%.2f` enough for the increased precision?
Did not consider the case where it used exponential format. There does not seem to be a printf format string that does what I want, and your suggestion seems to be closest (I knew about that but wanted to avoid always printing two digits after the comma).
I'll test things a little bit more and probably use yours.
Thanks for pointing out this formatting problem.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26595#discussion_r2259632029
More information about the hotspot-gc-dev
mailing list