Sam
Sam

Reputation: 53

Is there a Linux Command Line that shows JVM Code Cache usage at the moment?

We are receiving some error in one of our Java application that is running on Tomcat 7. I am looking for a command line that can show us the value of Code Cache at any moment. Is there any command like jstat that can print out the Code Cache value?

Thank you!

Upvotes: 1

Views: 1197

Answers (2)

Juraj Martinka
Juraj Martinka

Reputation: 4368

You can get detailed info from jcmd <PID> Compiler.codecache (assuming JDK, not JRE; may also depend on JDK version)

There's even a much more verbose jcmd <PID> Compiler.codelist.

Upvotes: 2

Sam
Sam

Reputation: 53

I was able to use JMXProxy and get the result using the command below. I am posting it, in case somebody else needs to get used Code Cache for Tomcat.

curl -u '<tomcat jmx-user>:<tomcat-jmx-user-password>' --url "http://localhost:8080/manager/jmxproxy/?qry=*:type=MemoryPool,name=Code%20Cache" | grep -o -P '{committed=[0-9]*, init=[0-9]*, max=[0-9]*, used=[0-9]*}'

Upvotes: 0

Related Questions