`
雨过天晴0521
  • 浏览: 154997 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Profiling with JProfiler

    博客分类:
  • IDE
 
阅读更多
Install JProfiler
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.

Profiling the Engine
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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics