Introduction

This article is a brief description of what the NetBeans Profiler provides so that one is thoroughly familiar with the functioning and usage of this module of the NetBeans IDE. It is a guide to quickly start profiling your NetBeans IDE.

NetBeans Profiler

The NetBeans Profiler is a monitoring tool for Java applications. The profiler offers full-featured profiling functionality of the NEtBeans IDE, they are as follows:
The NetBeans Profiler provides important information about the runtime behaviour of your application. All the profiling features of the NetBeans IDE are not covered and it doesn't reveal how to interpret profiling results to overcome the specific performance issues in your application program.
Using Profiler Module
To start an accurate profiling session, collaboration data for all the Java platforms must be present for use. Create a new project or select any of your existing projects from the project window and proceed using the following.
11.1.jpg
11.2.jpg
11.3.jpg
Selecting a Profiling Task
There are basically three tasks performed by the profiler module of NetBeans IDE; they are:
  1. Monitor Application
  2. Analyze CPU Performance
  3. Analyze Memory Usage
The main interface for running a profiling task is the dialog box for selecting the profile task, which requires us to choose the task depending on the profiling information we need.
Monitoring an Application
After monitoring an application high-level information is obtained about important properties of the target Java Virtual Machine(JVM). Use the following procedure to monitor your application.
  1. First of all, see that your application is set as the main project.
  2. Select the "Profile Main Project" from the "Profile" main menu. The following Profiling Task dialog box will appear.
11.4.jpg

  1. Click on the "Monitor" from the profiling dialog box and click "Run".
  2. After clicking on the "Run" button, the IDE launches the Profiler window, which opens on the left pane of the IDE. The Profiler window will provide you the following functions:
The result is shown in the following screenshot:
11.5.jpg
Analyzing CPU Performance
To analyze CPU performance, we need to determine how the application is profiled by choosing one among the following two methods:
  1. Entire application: In this method, the IDE takes samples and considers a stack trace periodically. This method is not so precise, it only makes you identify the method you want to instrument.

  2. Part of application: In this method, the methods of the application are instrumented. This method is more precise than the previous method since it specifies the time taken by each method of the application. When the thread enters the method, it generates a "method entry" event and as well as a "method exit" event at the time of exit.
Now use the following procedure to analyze the CPU Performance:
11.6.jpg
11.7.jpg

11.8.jpg
Analyzing Memory Usage
Use the following procedure to analyze Memory Usage:
11.9.jpg

  1. Record object creation only
  2. Record both object creation and garbage collection
11.10.jpg