Profiling Java Programs on the Mac
Java 6 on the Mac finally gives us the goodness of Sun’s VisualVM. This all-in-one Java profiler attaches to a running Java program. It shows threads and memory usage. That’s somewhat helpful.
But overwhelmingly awesome is the ability to profile CPU usage and memory usage of any running Java program. Which objects are created the most? Which objects are hogging memory? Which methods are called the most and consume the most processing time?
To run VisualVM on your Intel-based Mac OS X, from Terminal type “jvisualvm”.
I profiled Poker Copilot 2.0 and found way too much time was spent rendering the colourful “Mucked Hands Viewer”. I gave it some rendering smarts and now it barely registers on the “time used” chart.
I identified other surprising time-eaters in Poker Copilot which I’ll be dealing with in the days ahead.