`
mingren135
  • 浏览: 69124 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

本机远程profiling

 
阅读更多

 

 

服务器linux+tomcat,本机windows,简单记录一下Jprofiler remote的使用方法

1、服务端安装jprofiler

chmod +x jprofiler_linux_8_0_2.sh
./jprofiler_linux_8_0_2.sh -c

 

2、客户端配置

Integration type: [Generic application]
Selected JVM: Oracle 1.6.0 (hotspot)
Startup mode: Startup immediately, connect later with the JProfiler GUI

(1) Please insert

-agentpath:/home/admin/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849,nowait 

into the start command of your remote application right after the java command.

A remote session named Remote application on 10.235.144.94 will be created that connects to a running instance of the remote application that is started with the modified start command.

有3种启动模式,可以通过名字看出有什么区别的,nowait是服务器正常启动,不需要等待jprofiler连接。而下面这种模式,则一直等待jprofiler的连接。。(等到花儿也谢了)

Integration type: [Generic application]
Selected JVM: Oracle 1.6.0 (hotspot)
Startup mode: Wait for a connection from the JProfiler GUI

(1) Please insert

-agentpath:/home/admin/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849 

into the start command of your remote application right after the java command.

A remote session named Remote application on 10.235.144.94 will be created that connects to a running instance of the remote application that is started with the modified start command.

 

3、服务端配置,根据上面的提示信息,在java启动参数行加上,如:

JAVA_OPTS="$JAVA_OPTS -agentpath:/home/admin/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849,nowait"
export JAVA_OPTS

 

4、启动tomcat时,如果是“wait for...”模式,则会出现下方的提示信息,赶紧连吧

JProfiler> Protocol version 38
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Listening on port: 8849.
JProfiler> Instrumenting native methods.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Waiting for a connection from the JProfiler GUI ...

 如果是“no wait”模式,则不会有任何提示,服务器启动时即可用jprofiler连接,连接时会出现以下信息:

JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
JProfiler> Updating configuration.
JProfiler> Retransforming 5698 class files.

 

 参考

http://www.cnblogs.com/jayzee/p/3184087.html

http://www.blogjava.net/anymobile/articles/28248.html

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics