Using VisualVM, BTrace & Good Old Web Search
Now, while battery depletion under heavy load is perfectly normal, it does force you to keep a keen eye on CPU usage in the OSX Activity Monitor. That's how I noticed that while idle, NetBeans IDE was taking about 16% of my CPU... doing nothing really.
The first thing I wanted to know was what was going on in there? So I took VisualVM, connected it to the NetBeans IDE instance, and forced a Thread Dump:

This basically is a list of stack traces for all the threads, so that you can see the application's current state of execution. In my case, I probably didn't press the button at the right time, since I caught the threads all in a WAITING state, meaning that not much CPU should have been used:

Well, since the thread dump is just a quick snapshot, it was clear that I wasn't going to get a good view of what was consuming CPU, so I went to the heavy weight option: CPU Profiling.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)




Comments
Philippe Lhoste replied on Fri, 2009/08/21 - 4:25am
Beyond the particular context not interesting everyone (I don't use OSX nor NetBeans...), I appreciated the report of the detective work you did, showing good usage of tools. I knew VisualVM but it is the first time I see how to use BTrace, which is indeed an interesting tool if you can't (or don't want to) alter source code to add println's...
Thanks for sharing!
Mateo Gomez replied on Tue, 2012/04/17 - 12:20am
mexican dessert recipes
Matt Coleman replied on Tue, 2012/04/17 - 12:46am
debugging is such an important thing to do to fix the program and make it work
graphic design buffalo