Game Profiling

Hi!

What tools do you use for profiling your games??
Beside simple System.out.println() and System.currentMillis() are there any good programs you could recommend? Maybe one that could give statistics about different classes and methods CPU-usage.

Thanks.

If you can live with a pretty basic report, add “-Xprof” to the vm-args and once a thread ends, it will print out numerous types of information about the most called methods.

Note that some methods might seem to be missing, but that’s probably because they have been inlined into other methods.

If you want fancier profiler statistics, google for OptimizeIt or just “java profiler”.

Not pure profiling but I’m a recent convert to unit testing (I’ve known I should do it for years but only just got around to actually doing it) and that can certainly yield benefits to many aspects of development, especially in the early stages. It can give you a very good idea of how long different methods and parts of code are taking to run which can really help identify bottlenecks. I know netbeans comes packed with JUnit and I expect Eclipse does too.

Does that mean next you’ll be coming over to UML too? ;D

UML? I laugh in the face of UML…

For a simple start, mainly concerning memory consumption, threads, etc, you could use the jconsole tool which comes with your J2SE (1.5+I think): http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html
Basically you start your app with the -Dcom.sun.management.jmxremote switch, and in another shell start the jconsole Java app to connect to your app: that’s all.

In case you need a full blown profiler and are using the free Netbeans IDE, don’t miss to check out the amazing profiler for it (also freely available): http://profiler.netbeans.org/
(It’s going to still take a few weeks however in order to be usuable with the standard Java 1.5, in contrast to already using Java Mustang beta, the next J2SE release, or an older JDK. See site for more info on this.)

I use Eclipse with this plugin: http://eclipsecolorer.sourceforge.net/index_profiler.html

It works great.

I’ve used JProfiler and it helped me out quite a bit. It has a 30 day free demo period.

If your project is open-sources, I suggest trying out yourkit.com (http://www.yourkit.com) profiler. It integrates very nicely in both eclipse and netbeans. Accurate and gives back pretty much what you need. Its free if the project is opensourced.

if your projectisnt opensource, yourkit.com will cost you around $500.

DP

Netbeans 4.1 has a wonderful free profiler now…

profiler.netbeans.com