RFR: Report heap region stats in proper units

Aleksey Shipilev shade at redhat.com
Tue Aug 14 16:15:59 UTC 2018


This makes heap region stats to be reported in proper units, and not it very coarse integer
percents. This allows to distinguish regions where only a few objects are live, while current log
would report "L: 0%".

Patch:

> diff -r 644a4a9a6351 src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp
> --- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp  Tue Aug 14 18:01:57 2018 +0200
> +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp  Tue Aug 14 18:14:00 2018 +0200
> @@ -433,15 +433,15 @@
>    st->print("|BTE " INTPTR_FORMAT_W(12) ", " INTPTR_FORMAT_W(12) ", " INTPTR_FORMAT_W(12),
>              p2i(bottom()), p2i(top()), p2i(end()));
>    st->print("|TAMS " INTPTR_FORMAT_W(12) ", " INTPTR_FORMAT_W(12),
>              p2i(_heap->complete_marking_context()->top_at_mark_start(region_number())),
>              p2i(_heap->next_marking_context()->top_at_mark_start(region_number())));
> -  st->print("|U %3d%%", (int) ((double) used() * 100 / capacity()));
> -  st->print("|T %3d%%", (int) ((double) get_tlab_allocs() * 100 / capacity()));
> -  st->print("|G %3d%%", (int) ((double) get_gclab_allocs() * 100 / capacity()));
> -  st->print("|S %3d%%", (int) ((double) get_shared_allocs() * 100 / capacity()));
> -  st->print("|L %3d%%", (int) ((double) get_live_data_bytes() * 100 / capacity()));
> +  st->print("|U " SIZE_FORMAT_W(4) "%s", byte_size_in_proper_unit(used()),                proper_unit_for_byte_size(used()));
> +  st->print("|T " SIZE_FORMAT_W(4) "%s", byte_size_in_proper_unit(get_tlab_allocs()),     proper_unit_for_byte_size(get_tlab_allocs()));
> +  st->print("|G " SIZE_FORMAT_W(4) "%s", byte_size_in_proper_unit(get_gclab_allocs()),    proper_unit_for_byte_size(get_gclab_allocs()));
> +  st->print("|S " SIZE_FORMAT_W(4) "%s", byte_size_in_proper_unit(get_shared_allocs()),   proper_unit_for_byte_size(get_shared_allocs()));
> +  st->print("|L " SIZE_FORMAT_W(4) "%s", byte_size_in_proper_unit(get_live_data_bytes()), proper_unit_for_byte_size(get_live_data_bytes()));
>    if (_heap->traversal_gc() != NULL && _heap->traversal_gc()->root_regions()->is_in(region_number())) {
>      st->print("|R");
>    } else {
>      st->print("| ");
>    }

Testing: tier1_gc_shenandoah, eyeballing logs

Thanks,
-Aleksey



More information about the shenandoah-dev mailing list