Profiling with JProfiler

[b]Install JProfiler[/b]
Install the JProfiler GUI. It works on either Windows or Linux. The GUI need not be run on the same host as the application you will be profiling, however you will need the agent libs and jar available on the host to be profiled, so you may wish to install JProfiler in both places.

[b]Profiling the Engine[/b]
Copy agent.jar to the engine JRE
Make sure JProfiler's agent.jar is available in the classpath. The easiest way to do this is to copy agent.jar from {JPROFILER_HOME}/bin to {ENGINE_HOME}/jre/lib/ext

Make the native JProfiler libraries available to the engine JRE
On Linux, set LD_LIBRARY_PATH appropriately before starting the engine. Set it as follows in the same terminal as you will use to start the engine:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{JPROFILER_HOME}/bin/linux-x86/
On Windows, it's easiest just to copy the needed dlls to the engine directory. Copy all dlls (jprofiler.dll, jprofilerti.dll, libexpat.dll, and mingwm10.dll) from {JPROFILER_HOME}/bin/windows to the root of {ENGINE_HOME}.

Update engine JVM parameters
In the Fabric UI, go to Engine->Engine Configuration, and choose the configuration for the engine you want to profile. In the Engine JVM section, set Command-line Arguments to:
if JVM <=1.4.2

-Xrunjprofiler:port=8849 -Xbootclasspath/a:{ENGINE_HOME}/jre/lib/ext/agent.jar
if JVM >=1.5.0

-agentlib:jprofilerti=port=8849 -Xbootclasspath/a:{ENGINE_HOME}/jre/lib/ext/agent.jar
(Make sure you specify the full path to the agent.jar in the engine jre dir as above, not the path to the one in the JProfiler install directory, as the JProfiler GUI might recommend.)

Start (or restart) the engine
First, be sure the daemon is configured to start exactly one engine. You cannot run more than one engine as multiple JVMs would both try to bind to the profiling port.

On Linux, be sure to do this from an environment where LD_LIBRARY_PATH is updated as above.

On Windows, start it the normal way.

The engine daemon log should show:

JProfiler> Listening on port: 8849.
JProfiler> Native library initialized
JProfiler> If output stops here, please remove -Xdebug from the command line
JProfiler> Waiting for a connection from the JProfiler GUI ...
Connect JProfiler
Start JProfiler GUI, and create a Remote Application session using the wizard. The default values should be fine, just be sure to set the appropriate hostname if it is not local.

In General Settings for the session, add the engine JVM ({ENGINE_HOME}/jre) under the Java VMs tab. Make this the default JVM.

You can now connect the session.

Start profiling
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值