RFR: 8354362: Use automatic indentation in CollectedHeap printing [v4]

Joel Sikström jsikstro at openjdk.org
Thu Apr 17 09:13:35 UTC 2025


On Thu, 17 Apr 2025 05:23:10 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> This is because print_on() is in its "own" block, inside "Heap:", while print_on_error() prints its own blocks, like "ZGC Globals:" below. Other GCs behave in the same way.
>> 
>> 
>> Heap:
>>  ZHeap           used 7740M, capacity 9216M, max capacity 9216M
>>   Cache          1476M (2)
>>    size classes  128M (1), 1G (1)
>>  Metaspace       used 18526K, committed 18816K, reserved 1114112K
>>   class space    used 1603K, committed 1728K, reserved 1048576K
>> 
>> ZGC Globals:
>>  Young Collection:   Mark/51
>>  Old Collection:     Mark/18
>>  Offset Max:         144G (0x0000002400000000)
>>  Page Size Small:    2M
>>  Page Size Medium:   32M
>> 
>> ZGC Metadata Bits:
>>  LoadGood:           0x000000000000d000
>>  LoadBad:            0x0000000000002000
>> ...
>
> Hmm, that may be an indication that this should be in its own error reporting STEP, then? Probably does not matter much, just aesthetics

I agree. With some suggestions from @stefank, I've renamed print_on() to print_heap_on() and print_on_error() to print_gc_on() to better reflect their purpose. I've also separated print_heap_on() and print_gc_on() into their own "STEPs" in the printing in vmError.cpp:


STEP("printing heap information")
  ...
  print_heap_on();
  ...

STEP("printing GC information")
  ...
  print_gc_on()
  ...


With this change it would make better sense to print the precious log in the GC section rather than the heap section. This would change the printing order, which I have not yet done in this patch, so I think it would be better in a follow up RFE.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24593#discussion_r2048556654


More information about the shenandoah-dev mailing list