First Profiling Session
This page describes configuring and starting the first profiling session.
To profile a Java process, the profiler window which represents a profiling session needs to be opened in the IDE. The following chapters describe how to open the profiler window, configure profiling session and start collecting profiling data.
Note: A step by step guide on getting started with the profiler is available on the NetBeans Profiler Blog.
Opening Profiler Window
Profiler window controls the profiling session and displays the collected results. Only one profiler window can be opened in the IDE, multiple profiling sessions are not supported. There are three actions available to open the profiler window from Profile menu or Main toolbar (using the Profiler dropdown button):
- Profile (Main) Project action opens the profiler window for starting and profiling a project opened in the IDE. The project is eventually started for profiling the same way as using the Run Project action.
- Attach to Project action opens the profiler window for profiling an already running or manually started (locally or remotely) project opened in the IDE.
- Attach to External Process action opens the profiler window for profiling an already running or manually started (locally or remotely) process without sources.
By default the profiler window opens in Document area, but it can be drag'n'dropped to any position in the IDE or undocked to a separate window.
Tip: The profiler window can also be opened using the Profile or Profile File action in context menu of the Projects window or using the Profile Class or Profile Method actions in context menu of Java editor and Navigator. The same actions are also available in profiler snapshots.
Configuring Profiling Session
When the profiler window opens for the first time for a project or external process, it displays the Configure and Start Profiling screen listing the available profiler modes. One of these modes needs to be selected by clicking the Configure Session button in profile window toolbar:
- Telemetry - displaying actual CPU utilization and GC overhead, heap size and usage, surviving generations and GC intervals, numbers of threads and loaded classes. See Profiling Telemetry for more details.
- Methods - displaying call trees and hot methods, execution times and optionally invocation numbers. See Profiling Methods for more details.
- Objects - displaying live or all allocated objects with numbers of instances and total size, optionally showing allocation call trees. See Profiling Objects for more details.
- Threads - displaying process threads, times and states in a timeline. See Profiling Threads for more details.
- Locks - displaying locks including the owner and blocked threads with numbers of waits and total waiting time. See Profiling Locks for more details.
- SQL Queries - displaying SQL queries invoked using the JDBC API including invocation counts and times and the invocation call trees. See Profiling SQL Queries for more details.
Tip: Multiple modes can be selected for a single profiling session when the Enable Multiple Modes option is checked. Methods, Objects and SQL Queries modes are mutually exclusive and cannot be selected simultaneously.
Starting And Stopping Profiler
Once a profiler mode is selected, the profiler window displays controls and results for this mode.
The toolbar always shows the Profile or Attach button with a dropdown arrow. Clicking the button starts the profiled project (Profile) or connects the profiler to a running or manually started process (Attach). Clicking the dropdown arrow shows a popup menu which allows to change the profiler mode at any time.
If attaching to an already running Java process, the Attach Settings dialog will be displayed to select the process to be profiled. See Profiling Local Running Process for more details. A step by step guide on profiling live processes is available on the NetBeans Profiler Blog.
The next toolbar control is Stop button which either terminates the profiled project (when started by the Profile button) or disconnects the profiler leaving the profiled process running (when connected using the Attach button).
Tip: By default the profiler shows a No data collected yet message on top of the results component before the first profiling session. This message can be disabled using Tools | Options | Java | Profiler | General by unselecting the Show no data collected yet option.