(almost) painless profiling with TPTP 4.6.1 and Eclipse

The TPTP plugin for Eclipse in its versions 4.3, 4.4 and 4.5 was fairly bug prone – to the point of being barely usable. In particular it had a frustrating tendency to lock up the entire IDE…The latest version v.4.6.1  is more stable, even though setting it up still requires quite a lot of work… I only put up with it (just) because I prefer using Eclipse over Netbeans as my main development tool.

Summary of the steps involved below (tested with Eclipse 3.5, TPTP 4.6.1, running on Windows XP).

1.) Download TPTP  4.6.1 from within the comfort of your Eclipse IDE.
Replace 4.6.0 in the page linked above by 4.6.1… the documentation is not quite up to date :/
Once the install is over and Eclipse is restarted a new “Profiling and logging” perspective should be available in the main menu.

2.) Download the agent controller separately
In theory this step is not really needed, as TPTP now contains its own  Integrated Agent Controller (IAC).
In practice the standalone agent is more stable than the IAC.

3.) Unzip the agent controller on your local drive.

4.) Add the profiler DLLs to your path. From the command line:

Set TPTP_AC_HOME=<path to your local agent controller installation>
set JAVA_PROFILER_HOME=%TPTP_AC_HOME%\plugins\org.eclipse.tptp.javaprofiler

[more details on setting up the path here , check out section 3.3]

5.) Create a file called filters.txt (for example) where you’ll specify the classes which needs to be profiled.

Content of the file=
com.myclasses* * INCLUDE

This will profile all the methods of all classes in the com.myclasses packages.
Note that filtering is essential if you dont want to end up with hideously large profiling files.

6.) Run the application to be profiled
Add the following to the Java command line used to run the app so that all execution details are collected:

If all goes well a file name called trace.trcxml (by default) will start collecting the profiling info from the current directory.

7.) Open the profiling view in Eclipse and import the trace file generated
(a popup menu will appear where you can select additional filters and specific statistics to be run on the trace file)
Be prepared to wait if you didnt specify a broad enough set of filters in step 5)

8.) Once import is finished right click on the profiling file and open it with the appropriate editor
eg. use ExecutionStatistics and ExecutionFlow if profiling run with execdetails=true

Caveat: Profiling done that way doesnt give a realtime feedback on the behaviour of the app being profiled
(the trace.trcxml file generated needs to be fed into Eclipse repeatedly for up to date results).

On the plus side this method works for all kind of processes, remote or local, libraries or main programs.

If all else fails there’s always the Netbeans’s profiler, which is  very good, and free, or Yourkit (www.yourkit.com),which is excellent(but not free…)  Another alternative is VisualVm , which offers both profiling and sampling capabilities.

All these tools work pretty much out of the box, in stark contract with TPTP.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s