The source for learning NetBeans.
I’ve recently been playing around with the new Profiling Points feature of the NetBeans 6
Profiler. One of the nifty features is the Stopwatch Profiling Point.
You can set markers in the code to start a timer on one line and stop it on another.
When you profile the CPU performance of the class, the Profiling Point records its individual
results and makes them available in a Profiling Point report.
The Profiling Points show
up as glyphs in the margin of the Source Editor, as shown in Figure 1. You can
right-click each point and select to disable it, remove it, and even customize it.
Using the customize feature, you can adjust the line number of a beginning or
Once you run the Profiler against the Profiling Points, the results show up for all Profiling Points in the Profiling Point window (see Figure 2).
You can even drill down and view a report for each Profiling Point that shows the time the point was hit, the duration of the Stopwatch, and the class and line of code it was in. See Figure 3.
It’s an amazing feature that I know I will be using frequently when Profiling code. One interesting enhancement to this feature that I would love to have is a more intelligent ability to add a Stopwatch Profiling Point.
It would be nice if I could right-click a line of code that begins a block, such as a for-loop, while-loop, if, else, switch, etc, and select a menu item “Add Stopwatch to Block”. The NetBeans 6 editor has some semi-intelligent access to the underlying parse tree for the class thanks to the Javac API rewrite. The editor should know the first line and last line of a blcok (which it already does – think code folding). The Stopwatch’s starting and ending point could then be automatically added to the first and last lines of a code block. This would save time viewing several screens and configuration properties.