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.)