How to get non-heap "code cache" details using jstat

2k Views Asked by At

I want to find the non-heap memory code cache details of a remote JVM (JDK 8) running on windows from my windows machine. I can get the details using jconsole. But, what i need is to get the values using jstat command. GUI monitoring tools doesn't serves my purpose. Thanks

2

There are 2 best solutions below

1
On

code cache get filled up with interpreter, compiled, runtime stub codes.

the key user of codecache is compiled code. you can get compiled code stats using jstat. this will give decent info on code cache use.

0
On

Use jstat arg and pid of java process e.g. for pid 616

jstat -compiler 616

Compiled Failed Invalid Time FailedType FailedMethod

7979      5       0   121.28          1 weblogic/xml/babel/baseparser/BaseParser parseSome

jstat -printcompilation 616

Compiled Size Type Method

7979    331    1 weblogic/servlet/internal/CompleteMessageTimeoutTrigger timerExpired

jconsole Memory tab and select Code Cache in drop down shows the current Code Cache Size

To get your JVM defaults (find on windows or grep on unix):

java -XX:+PrintFlagsFinal | find "CodeCache"

uintx CodeCacheExpansionSize                    = 65536                               {pd product}
uintx CodeCacheMinimumFreeSpace                 = 512000                              {product}
uintx InitialCodeCacheSize                      = 2555904                             {pd product}
 bool PrintCodeCache                            = false                               {product}
 bool PrintCodeCacheOnCompilation               = false                               {product}
uintx ReservedCodeCacheSize                     = 251658240                           {pd product}
 bool UseCodeCacheFlushing                      = true                                {product}