Netbeans 6.5 has a very useful Profiler which helps a lot in pinpointing exactly which method is the culprit when your app comes to a crawl:
– In Netbeans pick Menu Profile -> Profile Main Project to active the profiler (which I believe is built on top of VisualVM).
– Rerun the app and replay the actions which caused it to freeze
– at that point move on to the Netbeans “Profiler” panel and take a snapshot of the threads call tree.
– Sorting the call tree by time descending should make any bottleneck immediatly obvious.
Example: below is the call tree associated with a Java app I’m currently working on.
The refreshTicksHorizontal method (part of the JFreeChart API) seems to take a suspisciously long time to execute…
Poking around the JFreeChart forums it became soon clear why…