Remote profilling java application

浪尽此生 提交于 2019-12-04 22:15:20

问题


I'd like to ask how I can profile REMOTELY a java application. For debugging I can say which port the JVM must listen etc since the machine I'm trying to access is behind an ssh gateway so I manually create an SSH tunnel but I've been googling about the same thing but when profiling and I couldn't seem to find. Basically I'm looking for the equivalent of this command:

java -agentlib:jdwp=transport=dt_socket,server=y,address=8000 -jar /bla/bla 

but for profiling so that I can remotely attach a profiler.


回答1:


Disclaimer: My company develops JProfiler

With JProfiler, the VM parameter is like this:

-agentpath:/path/to/libjprofilerti.so=port=8849

"/path/to/libjprofilerti.so" is the path to the native agent library, on Linux x86, for a 32-bit JVM it would be [JProfiler installation directory]/bin/linux-x86/libjprofilerti.so. With the port parameter, you can tell the agent to listen on a specific port. You can set this to the port of your SSH tunnel.

You can easily generate this VM parameter by invoking Session->Integration Wizards->New Remote Integration in JProfiler's main menu:

On your local machine, you create a new session of type "Attach to profiled JVM" and choose the local port of your SSH tunnel (10022 in the screen shot):



来源:https://stackoverflow.com/questions/7571247/remote-profilling-java-application

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