This article provides a step by step guide to create, configure and start the first profiling session for a project with the new NetBeans profiler 8.1. See profiler documentation for details on configuring and running the profiler.



1. Get The Profiler:

Download the NetBeans IDE 8.1 distribution of your choice (Java SE technology is a requirement to get the profiler) and install or unzip it to your system. Create a sample Java application Anagram Game using File | New Project... | Samples | Java.





2. Open Profiler Window:

Select the AnagramGame project node in Projects window and create a profiling session for this project by invoking the Profile Project (AnagramGame) action either in the main IDE menu or the IDE toolbar. The action can also be invoked using the Ctrl+F2 shortcut. Profiler window representing new profiling session opens in the editor area.





3. Configure Profiling Session:

Click the Configure Session button in the Profiler window toolbar and select the profiler mode of your choice (for example Methods). The Profiler window displays a hint for each profiling mode to help you select the right one. Once a mode is selected, the Profiler window starts displaying its actions in toolbar and results view in the rest of the area. See Profiling Methods docs for details on profiling application performance.





4. Start Collecting Data:

Start the profiling session by clicking the Profile button in the Profiler window toolbar. This action starts the project the same way as using the Run action and automatically configures the profiler to collect data from its process. Based on the profiler mode selected in the previous step you'll see the profiling data being collected.





5. Switch Profiler Mode:

Modify the profiling mode on the fly while the profiled application is running by clicking the Profile button dropdown arrow and selecting a different mode from its context menu (for example Objects). The mode is changed immediately after selecting it and the Profiler window starts displaying new data. See Profiling Objects docs for details on profiling application memory usage.





6. Finish Profiling Session:

Finish the profiling session by clicking the Finish profiler session button in the Profiler window toolbar. This action terminates the profiled project and stops getting the results. You can also terminate the profiled process by closing its window to stop the profiling session. In this case you'll be given a chance to take a snapshot of the profiling data collected so far (not possible once the session has terminated).





7. Restore Profiling Session:

Close the Profiler window and/or restart the NetBeans IDE. Create a new profiling session for the Anagram Game project and note that all the settings have been persisted for the project from the previous session.







Congratulations, you've just learned the essentials of profiling with the new NetBeans profiler!