tags:

views:

1346

answers:

6

Hi guys,

I'm developing both a Java app and J2EE webapp using Eclipse Europa on Mac OS X 10.5.8. The webapp provides a RESTful API layer for the Java app I've written. I'm running the webapp using tomcat from inside Eclipse.

It seems like there are some serious performance issues and I would like to use a profiler to narrow down on these problems, but I haven't been able to find anything decent to work with. I've looked at the following options:

  • TPTP, ships with Eclipse: A known bug prevents the profiler from running on Mac :(
  • JProfiler: doesn't have a Mac version
  • Profiler4J: Installed it, but couldn't get it to work
  • Shark: comes with MacOSX, but when I choose "Java Time Profile" and run my webapp, it doesn't allow me to choose any processes to profile
  • Other tools I looked at cost a lot of $$ and this is an open-source project

I've looked through this list: here but there are too many choices and too little time to go through them ALL!!

Does anyone know of an easy-to-use visual Java profiler that actually works on Mac, given my environment? I would love to hear your suggestions.

Thanks a lot guys, Ali

+2  A: 

I'd recommend Yourkit. It's by far the best Java profiler I have used (although it's somewhat costly).

http://www.yourkit.com/

Although it costs money, you can get trial licenses.

Edit: Looks like they offer an Open Source license (for free). If you can get it, go for it: http://www.yourkit.com/purchase/index.jsp

Malaxeur
+3  A: 

Maybe you could give VisualVM a try, if Java 6 is an option. This nice Setting up Sun's VisualVM on Mac OSX blog post explains how to get it working on Mac OSX.

Or get an open source license for Yourkit which is indeed a very good tool as Malaxeur pointed out.

Pascal Thivent
I had the same problem. Now, almost 1 year later, VisualVM brings a dmg/.app and an Eclipse-Plugin. And is free! Absolutely the way to do profiling on a Mac. I tried TPTP (which is not fully implemented) and Shark (which works only with -d32) as well...
roesslerj
A: 

I am not sure how hard it would be to get the project working under Netbeans... but if you can do that without much trouble then the profiler should work without issue.

VisualVM and Yourkit, as pointed out by the others here, are both good as well.

TofuBeer
+2  A: 

I'm using JProfiler on Mac OS X and I'm very happy with it. I don't know why you wrote that it doesn't support OS X, they even have a DMG download on their site. It is an expensive piece of software - I would suggest contacting their sales. Most companies are happy to donate licenses to open source projects.

Shark is the old tool. The latest XCode comes with Instruments. A gorgeously designed profiling application based on DTrace. It can profile Java application, but you won't come close to the level of details you will get with tools built to instrument Java.

Another option is to use TPTP. The Eclipse plugin works on OS X, but the agent controller does not. You can run a virtualized Linux (I use VMWare Fusion, but you can use the FOSS alternative, Virtualbox) and run your Tomcat there. You can connect the TPTP on the OS X and profile the application running on the Linux box.

zvikico
+1 for JProfiler. I also use it on a Mac.
z5h
A: 

Definitely YourKit http://www.yourkit.com

Serge
A: 

Be aware that Shark does not work with Java running in 64-bit mode. With OS X 10.6 java runs in 64-bit by default. If you give java the "-d32" flag when it starts, it will run in 32 bit mode. Combine this with the "-agentlib:Shark" flag, and then start Shark. You now should be able to profile your Java program using OS X 10.6 and Shark. If profiling Java in 32-bit mode is acceptable, then this might be of use to you.

Justin Voskuhl