Thursday, November 6, 2008

Profiling a Remote Application in Eclipse

I came across this guide which mentioned about attaching the Eclipse profiler to a remote Java application. I was stuck for some hours, asked my question in #java and #eclipse but got no response.. then, realized that, the instructions are old!

Instead, I visited the TPTP site, downloaded the Agent Controller and followed the instructions in this page to get things up and running. Basically,
  • Add $TPTP_AC_HOME/lib:$TPTP_AC_HOME/bin:$TPTP_AC_HOME/plugins/org.eclipse.tptp.javaprofiler to $LD_LIBRARY_PATH
  • Add $TPTP_AC_HOME/bin to $PATH
  • Run SetConfig.sh to configure the AC
  • Run ACStart.sh to start AC
  • Add '-agentlib:JPIBootLoader=JPIAgent:server=enabled;CGProf' to your JAVA_OPTS (ldd and nm are good commands)
  • Start your Java application
  • Profile and hook into the application by selecting "Attach to Agent" in the Eclipse's dialog
- yc

No comments: