RFR: 8298126: Print statistics for objects in CDS archive heap

Ioi Lam iklam at openjdk.org
Mon Dec 5 22:29:37 UTC 2022


For diagnostic purposes, it's useful to print out statistics of the objects in the CDS archive heap. For example, this shows the number of objects with a distribution of different sizes.


[6.772s][info][cds,heap]        0 objects are <= 8      bytes (total        0 bytes, avg      0.0 bytes)
[6.772s][info][cds,heap]     1205 objects are <= 16     bytes (total    19280 bytes, avg     16.0 bytes)
[6.772s][info][cds,heap]    15717 objects are <= 32     bytes (total   411024 bytes, avg     26.2 bytes)
[6.772s][info][cds,heap]     4127 objects are <= 64     bytes (total   198080 bytes, avg     48.0 bytes)
[6.772s][info][cds,heap]     2380 objects are <= 128    bytes (total   243016 bytes, avg    102.1 bytes)
[6.772s][info][cds,heap]      293 objects are <= 256    bytes (total    47920 bytes, avg    163.5 bytes)
[6.772s][info][cds,heap]       51 objects are <= 512    bytes (total    17112 bytes, avg    335.5 bytes)
[6.772s][info][cds,heap]       18 objects are <= 1024   bytes (total    14480 bytes, avg    804.4 bytes)
[6.772s][info][cds,heap]       11 objects are <= 2048   bytes (total    13440 bytes, avg   1221.8 bytes)
[6.772s][info][cds,heap]        3 objects are <= 4096   bytes (total     9808 bytes, avg   3269.3 bytes)
[6.772s][info][cds,heap]        3 objects are <= 8192   bytes (total    12840 bytes, avg   4280.0 bytes)
[6.772s][info][cds,heap]        4 objects are <= 16384  bytes (total    37240 bytes, avg   9310.0 bytes)
[6.772s][info][cds,heap]        0 objects are <= 32768  bytes (total        0 bytes, avg      0.0 bytes)
[6.772s][info][cds,heap]        0 objects are <= 65536  bytes (total        0 bytes, avg      0.0 bytes)
[6.772s][info][cds,heap]        0 objects are <= 131072 bytes (total        0 bytes, avg      0.0 bytes)
[6.772s][info][cds,heap]        0 objects are <= 262144 bytes (total        0 bytes, avg      0.0 bytes)
[6.772s][info][cds,heap]        0 huge  objects               (total        0 bytes, avg      0.0 bytes)
[6.772s][info][cds,heap]    23812 total objects               (total  1024240 bytes, avg     43.0 bytes)


These stats are useful when implement large changes in the CDS heap archiving code. For example, [JDK-8296344](https://bugs.openjdk.org/browse/JDK-8296344) significantly changes how the objects are copied into the archive. We can use these stats to verify that the exact same objects are copied.

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

Commit messages:
 - 8298126: Print statistics for objects in CDS archive heap

Changes: https://git.openjdk.org/jdk/pull/11520/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11520&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8298126
  Stats: 62 lines in 2 files changed: 62 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/11520.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11520/head:pull/11520

PR: https://git.openjdk.org/jdk/pull/11520


More information about the hotspot-runtime-dev mailing list