Monday, December 24, 2007

Profiling Java apps within Eclipse

Recently I've started writing a medium to large size java application which will only be of interest to cyclists, may or may not cause some hubub in the cycling analysis community, and is complicated enough that it really requires profiling. In doing the standard googling (i.e. "eclipse profiling java") I found very little of use. I came across Profiler4J which is not designed for Eclipse, nor is there a plugin, but seems pretty cool and does some good things.

After some labor I was able to make it work from within Eclipse and here are the instruction.


Get Profiler4J. I got it from CVS, these instructions are probably compatible with the .ZIP file that is provided on the site.

Add the following items to your Eclipse workspace (
I put these items into my lib/ directory in a subdirectory called profiler4j):
agent.jar
console.jar
the lib/ directory
p4j-exclusions.txt

Create a new run configuration for the class containing main(...) that you want to profile. Do this by right-clicking the class, selecting "Run As->Run..." If you've run this class before (and I assume you have before you start profiling) duplicate your existing run profile and modify it as follows: Append Profiler4J to the configuration name, add the following VM argument (in the arguments tab) "-javaagent:${workspace_loc:<project>/lib/profiler4j/agent.jar" where <project> is the name of your project.

Then run the application with the new profile. After the launch ( you should see the launch waiting for the console.jar to be run in your console view) run the console.jar you added to the application. I do this by right-clicking on console.jar and using the "JarLaunch->Run" menu. From here, follow the instructions provided by Antonio on his site.

Thursday, July 12, 2007

if you treat things like chess you might lose your queen.

It turns out that if you analyze every situation through the worst-case scenario lens then you might drive those around you crazy. So crazy they may ask you to shut up... repeatedly. Luckily, it appears all will work out fine, even if there are moments of complete insanity.
Powered By Blogger