问题
in java programs, running the programs with java profiler will generate profiling output Ex- java -prof classfile_name
How to get same profiling output of java programs running on Tomcat?
I want to get an profiling output like this
count callee caller time , like this in profiling output
1 java.util.LinkedHashMap.init()V java.util.HashMap.(IF)V 0
Can you tell me how to get an output like this for programs running on Tomcat?
回答1:
Tomcat is also just a Java application, so you can add the same VM parameters by defining the JAVA_OPTS
environment variable in startup.bat/startup.sh
of your Tomcat distribution.
However, I would really recommend to use a real profiler, there are several free and commercial alternatives. The major free one is visualvm and as a commercial solution I recommend JProfiler (disclaimer: my company develops that tool).
In those profilers, look for the "Hot spot" views which will show you the kind of information that you are looking for.
来源:https://stackoverflow.com/questions/7479715/how-to-get-profiling-output-of-java-programs-running-on-tomcat-using-java-prof