Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to monitor the compiled code cache in Java?

Tags:

OK - I know I can run my java process like this :

java -XX:+PrintCompilation <FooProgram>

and I can see output like:

c:\>java -XX:+PrintCompilation -jar c:\FooProgram.jar
  1       java.lang.String::charAt (33 bytes)
  2       java.lang.Math::max (11 bytes)
  1%      java.util.jar.JarFile::hasClassPathAttribute @ 78 (197 bytes)
  3       java.lang.String::hashCode (60 bytes)
  4       java.lang.String::indexOf (151 bytes)
  5       java.util.Properties$LineReader::readLine (452 bytes)
  6       java.lang.Object::<init> (1 bytes)
  7       java.lang.String::indexOf (166 bytes)
  8       java.lang.String::equals (88 bytes)

to give me an idea of what methods are compiled, uncompiled, marked as zombies, etc. Is there anyway to monitor the usage of the code cache where these methods get compiled into? I see a message when the compiler code cache is full saying something like: "I'm full, no more compilations for you...", but it would seem as though something like this is a lagging indicator that we have a problem. I know how to print the max size of the code cache, what I'm looking for really is a way to see how its being filled up over time.

like image 401
Amir Afghani Avatar asked Mar 03 '10 00:03

Amir Afghani


1 Answers

Old question but... I'll answer anyways... I have build a VisualVM plugin that will monitor stats about the code cache. It has been included in the open source version plug-in repository. Alternatively you can down load it and the source from java.net.

Oops, forgot link... https://java.net/projects/memorypoolview/

like image 143
Kirk Avatar answered Oct 12 '22 09:10

Kirk