RFR: Allocation tracker should really report bytes

Aleksey Shipilev shade at redhat.com
Fri Jul 13 14:51:45 UTC 2018


-XX:+ShenandoahAllocationTrace log says:

[125.673s][info   ][gc,stats] Sizes (in bytes):
[125.673s][info   ][gc,stats]     256 -     512:           0           0           0         381
[125.673s][info   ][gc,stats]     512 -    1024:           0           0           1         217
[125.673s][info   ][gc,stats]    1024 -    2048:           0          18           0         157
[125.673s][info   ][gc,stats]    2048 -    4096:           0          20           3         144
[125.673s][info   ][gc,stats]    4096 -    8192:           0           6           0          58
[125.673s][info   ][gc,stats]    8192 -   16384:           0          57           1          14
[125.673s][info   ][gc,stats]   16384 -   32768:           0           0           0          14
[125.673s][info   ][gc,stats]   32768 -   65536:           0           1           1          16
[125.673s][info   ][gc,stats]   65536 -  131072:           2           7          42          14

...but "in bytes" part is a lie, because we need to do:

diff -r 95c1c543d1a5 -r 9bfd1fa84d27 src/hotspot/share/gc/shenandoah/shenandoahAllocTracker.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahAllocTracker.cpp	Fri Jul 13 16:08:29 2018 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoahAllocTracker.cpp	Fri Jul 13 16:40:38 2018 +0200
@@ -70,7 +70,9 @@

   out->print_cr("Sizes (in bytes):");
   for (int c = size_min_level; c <= size_max_level; c++) {
-    out->print("%7d - %7d:", (c == 0) ? 0 : 1 << (c - 1), 1 << c);
+    int l = (c == 0) ? 0 : 1 << (c - 1);
+    int r = 1 << c;
+    out->print("%7d - %7d:", l * HeapWordSize, r * HeapWordSize);
     for (size_t t = 0; t < ShenandoahHeap::_ALLOC_LIMIT; t++) {
       out->print(SIZE_FORMAT_W(12), _alloc_size[t].level(c));
     }

Testing: tier1_gc_shenandoah, cross-referencing stats with TLAB sizes

Thanks,
-Aleksey



More information about the shenandoah-dev mailing list