How to get profiling output of java programs running on Tomcat using java -prof option?

老子叫甜甜 提交于 2020-01-16 04:52:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!