I did this long ago. Since I’m not required to do it repeatedly, it took me another 15 minutes to get warmed up. This time I’m recording the procedures here as a preparation for tomorrow’s exploration on why the hell that tomcat instance was taking so long to start up.

  1. JVM arguments: -XrunpiAgent:server=standalone,file=/home/iusr/tc.trcxml,profile=/home/iusr/piAgent.options,filters=/home/iusr/piAgent.filters. It’s convenient to export all this twittering to JAVA_OPTS which is used by tomcat to pass to JVM;
  2. Adjust the LD_LIBRARY_PATH environment variable to include directory “<eclipse_install_or_ext_point>/plugins/org.eclipse.hyades.execution.<OS>.<CPU_ARCH>_<VERSION>”, e.g., in my Edgy box it’s “/usr/local/eclipse-extension/eclipse.org/tptp/eclipse/plugins/org.eclipse.hyades.execution.linux.x86_4.2.2.v200701141614”;
  3. Compose the profile configuration, filters configuration. Refer to http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.tptp.platform.doc.user/ref/rsaproffilt.htm and http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.tptp.platform.doc.user/tasks/teprofsa.htm for the proper format.
  4. Run the java class, of course:)

A profile configuration consists several entries, here’s an example (“^\*.*$” lines stand for comments):

* all | none
MONITOR_MODE = all
* true | false
FILTERS = true
* none | deletes | frees | moves | deletesAndMoves | movesAndFrees
TRACK_GC_EVENT_TYPES = movesAndFrees
* static | relocatable | staticAndRelocatable
ID_STYLE = staticAndRelocatable
* true | false
* OPTIONS = false
TIMESTAMPS = true
METHOD_COUNTS = true
OBJ_ALLOC_IS_ARRAY = true
* none | normal | boundary | contiguous | boundaryAndContiguous
STACK_INFORMATION = contiguous
* true | false
* TICKET = true
* full | none | noObjectCorrelation
TRACE_MODE = full
* true | false
* TRACE_ID_REFS = true

Apparently this configuration requires much work to do, so my CPU got 99% utilized just now:P.
The filters configuration is more straightforward, only a wildcard string indicating the desired packages or classes, another wildcard string indicating the methods, and a directive indicating the whether matching packages or classes are to be included or excluded. Here’s an example:

package = com.*
method = *
mode = INCLUDE

Since some subtle differences amongst different Linux distros and versions, the configuration above varies. I once saw a web page saying it’s necessary to add the directory “<eclipse_install_or_ext_point>/plugins/org.eclipse.hyades.execution.<OS>.<CPU_ARCH>_<VERSION>” not only to LD_LIBRARY_PATH but also to PATH. I haven’t tried this out yet, since adding it to LD_LIBRARY_PATH works every time and appears to be more reasonable. Particularly, if the piAgent failed to get loaded or started, take a look at the output of `ldd <eclipse_install_or_ext_point>/plugins/org.eclipse.hyades.execution.<OS>.<CPU_ARCH>_<VERSION>/libpiAgent.so` to check out if there’s anything dependent missing.
Whoa, I cannot help starting the agent on our main testing machine to find out what the hell contributed to the latencies.