RFR(s): 8221925: [metaspace] provide size histogram for jcmd VM.metaspace

Thomas Stüfe thomas.stuefe at gmail.com
Wed Apr 3 16:41:43 UTC 2019


Hi all,

could I get reviews please for this small enhancement:

rfe: https://bugs.openjdk.java.net/browse/JDK-8221925
cr:
http://cr.openjdk.java.net/~stuefe/webrevs/8221925-metaspace-histogram/webrev.00/webrev/index.html

This patch adds a small feature to the VM.metaspace command, a size
histogram. That one is useful to get an idea of the size distribution of
allocations, as a base for improving chunk allocation strategies.

----------------
Example output:

$ jcmd stuefe VM.metaspace histo

12835:
<snip>

Size histogram:
Non-Class:
                  <16     <32     <64     <128    <256    <512    <1k
 <2k     <4k     <8k     <16k    <32k    <64k    <128k   <256k   larger
-- by object type: --
Class             0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
Symbol            0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
TypeArrayU1       0       4056    2281    1098    1068    251     116
 40      10      1       0       0       0       0       0       0
TypeArrayU2       2609    1698    1604    732     321     102     41
11      2       0       0       0       0       0       0       0
TypeArrayU4       78      193     49      0       0       0       0
 0       0       0       0       0       0       0       0       0
TypeArrayU8       0       3563    2307    2298    1233    267     113
 27      2       0       0       0       0       0       0       0
TypeArrayOther    0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
Method            0       0       0       32151   0       0       0
 0       0       0       0       0       0       0       0       0
ConstMethod       0       0       1225    18968   9242    1958    526
 202     23      4       1       2       0       0       0       0
MethodData        0       0       0       0       0       424     2323
364     103     26      8       1       0       0       0       0
ConstantPool      0       0       0       89      286     1577    1297
450     225     110     40      10      1       0       0       0
ConstantPoolCache 0       0       187     223     344     1432    936
 229     145     60      23      4       1       0       0       0
Annotations       0       0       67      0       0       0       0
 0       0       0       0       0       0       0       0       0
MethodCounters    0       0       0       12838   0       0       0
 0       0       0       0       0       0       0       0       0
-- by space type: --
Standard          489     4008    3222    25473   4066    1458    2239
743     227     87      44      15      2       0       0       0
Boot              539     3380    2992    33203   5796    2351    2065
580     283     114     28      2       0       0       0       0
UnsafeAnonymous   159     622     506     1221    132     202     48
0       0       0       0       0       0       0       0       0
Reflection        1500    1500    1000    8500    2500    2000    1000
0       0       0       0       0       0       0       0       0
-- total: --
                  2687    9510    7720    68397   12494   6011    5352
1323    510     201     72      17      2       0       0       0

Class:
                  <16     <32     <64     <128    <256    <512    <1k
 <2k     <4k     <8k     <16k    <32k    <64k    <128k   <256k   larger
-- by object type: --
Class             0       0       0       0       0       0       4013
219     4       0       0       0       0       0       0       0
Symbol            0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
TypeArrayU1       0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
TypeArrayU2       0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
TypeArrayU4       0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
TypeArrayU8       0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
TypeArrayOther    0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
Method            0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
ConstMethod       0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
MethodData        0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
ConstantPool      0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
ConstantPoolCache 0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
Annotations       0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
MethodCounters    0       0       0       0       0       0       0
 0       0       0       0       0       0       0       0       0
-- by space type: --
Standard          0       0       0       0       0       0       1129
143     4       0       0       0       0       0       0       0
Boot              0       0       0       0       0       0       1200
76      0       0       0       0       0       0       0       0
UnsafeAnonymous   0       0       0       0       0       0       184
 0       0       0       0       0       0       0       0       0
Reflection        0       0       0       0       0       0       1500
0       0       0       0       0       0       0       0       0
-- total: --
                  0       0       0       0       0       0       4013
219     4       0       0       0       0       0       0       0

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


I kept the coding as simple and lean as possible. I think the patch is
reasonably small.

I ran all jtreg Metaspace tests locally; will run the usual jdk-submit
tests and put this through our nightlies at SAP.

Thank you!

Best Regards, Thomas


More information about the hotspot-runtime-dev mailing list