Profiling » History » Revision 11
« Previous |
Revision 11/25
(diff)
| Next »
Andreas Kohlbecker, 04/09/2013 09:05 PM
Java Profiling¶
- Table of contents
- Java Profiling
YourKit Java Profiler¶
Profile the cdmserver (cdmlib-remote-webapp)¶
Preparation:
To enable profiling on remote server you just need to copy appropriate libyjpagent.so and, put it into LD_LIBRARY_PATH and add "-agentlib:yjpagent" to JVM parameters. Most probable you copied wrong library file, that's why server JVM doesn't start.
( For another way to specify the shared lib see http://www.yourkit.com/docs/java/help/agent.jsp )
For your convenience you can use the following script to start eclipse and set the LD_LIBRARY_PATH:
#!/bin/bash ########################################### # Configuration # ECLIPSE_FOLDER=~/opt/eclipse-juno-SR2 YOURKIT_FOLDER=~/opt/yjp-9.0.8 OS_TYPE="linux-x86-64" # ########################################### export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${YOURKIT_FOLDER}/bin/${OS_TYPE} $ECLIPSE_FOLDER/eclipse -vmargs -Duser.name="a.kohlbecker"
Run cdmlib-remote-webapp in profiling mode:
Use the launch configuration cdmserver - profile which is distributed via the cdmlib source control.
creating a snapshot from within an application¶
Add yjp.jar
from the yourkit lib folder to the classpath. Do not move it from it's original location!!!!.
Capture a snapshot by
com.yourkit.api.Controller controller = new Controller(); controller.captureMemorySnapshot();
if you wnat to do multiple snapshots create a method like the following in the class to be tested:
private void captureMemorySnapshot() { if (controller == null) { try { controller = new Controller(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { controller.forceGC(); // not sure if this is needed logger.info("new snapshot: " + controller.captureMemorySnapshot()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
TPTP¶
_Using TPTP is discouraged, we rather recommend using the YourKit Java Profiler
in Eclipse by using TPTP.
Install TPTP as eclipse plugin using Eclipse update site Help -> Software updates -> Find and Install -> Search for new features to install -> check Europa Discovery Site" -> TPTP and select required or check "TPTP
Download and extract "Agent Controller" from http://www.eclipse.org/tptp/home/downloads/
execute bin\SetConfig.bat in extracted package. Set path to Java 1.5 (for cdmlib projects ?).
execute bin\RAServer.exe to start the Agent
start profiling from within eclipse ...
Updated by Andreas Kohlbecker over 11 years ago · 11 revisions