The latter part of last week profiling some Java code at work in order to ring every last usable CPU cycle out of it. I currently do all Java (and some C++) development in [Eclipse] which has an excellent debugger and a really nice interface. It’s also nice to have the same environment on OSX and Linux :)
The best tool for the job seems to be the [Eclipse Test and Performance Tools] which provide lots of profiling goodies.
My current setup is:
- Eclipse 3.2
- TPTP 4.0.1
- Latest version of the Agent Controller
To use TPTP you need the Eclipse XSD and EMF plugins installed so install those first using the auto update function. The TPTP installation is pretty simple, download the zip of all the TPTP tools and unzip it into the plugins directory of Eclipse.
You also need to install the Agent Controller (don’t let the documentation fool you into thinking this is optional, cos it’s not). Unzip the Agent Controller to a directory and run the SetConfig.bat file in the bin directory. Just use all the default options. You can then run RAServer from the command line to start the agent controller.
Now you can start Eclipse, create a new run instance, set the options in the Profile tab of the run settings, and profile your ass off. Unfortunately the profiler eats memory as if it’s cheaper than chips so you’ll almost certainly have to increase the amount of memory the JVM is allowed to use to stop getting “Out Of Memory” errors.
To do this make sure you call eclipse like this:
eclipse.exe -vmargs -Xmx512M