FaqProfilerRedesign81

Contents

Redesigned Profiler in NetBeans 8.1

This page is to help you with getting started using the redesigned profiler introduced in NetBeans 8.1.

Fresh profiler session


What are the profiler entrypoints?

There are several entrypoints to start profiling:

Profile menu
  • Profile menu
    • Profile Project action
    • Profile File action
    • Profile Test File action
    • Attach to Project action
    • Attach to External Application action
  • Profile toolbar dropdown
    • Profile Project action
    • Attach to Project action
    • Attach to External Application action
  • Projects window
    • Profile Project action
    • Profile File action
  • Navigator window
    • Profile Class
    • Profile Method
  • Java editor
    • Profile Class
    • Profile Method

What do the Profile actions do?

  • Profile Project - follows the Run Project action behavior, starts the project and profiles it
  • Attach to Project - attaches to a Java process with project opened in the IDE, locally running or manually configured and started locally/remotely for profiling from startup
  • Attach to External Process - attaches to a Java process without project, locally running or manually configured and started locally/remotely for profiling from startup
  • Profile File - follows the Run File action behavior, starts the project/file and profiles it
  • Profile Test File - follows the Test File action behavior, starts the file tests and profiles it
  • Profile Class - opens a profiler session for the defined project and configures it for profiling the selected class
  • Profile Method - opens a profiler session for the defined project and configures it for profiling the selected method

How do I access and configure the profiler?

Fresh profiler session

Invoking any of the abovementioned actions will open the Profile window with the appropriate context - Profile actions open the window for profiling a project and Attach actions open the window for attaching to a Java process.

When profiling a project/external process for the first time, the How To Configure Profiling Session screen appears and points to the Profile dropdown menu which configures the profiler. The profiler provides the following profiling modes/features:

  • Telemetry - application monitoring with graphs of CPU and memory usage, and numbers of threads and loaded classes
  • Methods - profiling methods executions and times, previously called CPU profiling
  • Objects - profiling object allocations and sizes, previously called Memory profiling
  • Threads - monitoring and visualizing thread states in a timeline
  • Locks - profiling and visualizing lock contention

By default only one profiling feature can be enabled for the profiling session. When the Profile multiple features choice is selected in the Profile dropdown menu, multiple features can be selected for a profiling session with the exception of Methods and Objects profiling, which are mutually exclusive.

How do I setup the profiler to attach to a process?

Attach Settings dialog

The profile menu contains Setup attach to project/process action if the Profile window has been opened using an Attach action. This action opens the Attach Settings dialog to configure the session for attaching to a Java process, locally running or manually configured and started locally/remotely for profiling. The attach mode is controlled by the Profile: dropdown in the Attach Settings dialog. There are three types of profiler attach:

  • Already running local Java process - The default attach type, the displayed list shows all Java processes ready for profiling - local processes running Java 6+, started by the same user running the profiler (Windows services not supported). Selecting a process configures the profiler to attach to that process after clicking the Attach button (the profiler will attach to a process with similar main class and PID). Selecting the Always connect to [main class] option filters out processes with different main classes. If there's exactly one process with this main class ready for profiling, the profiler connects to this process automatically without checking its PID.
  • Manually started local Java process - Attach type to profile a local Java process from its startup. This type also enables profiling local processes started by a different user or Windows services. Based on the target JDK and architecture the dialog shows steps and command line argument to configure the target process for profiling.
  • Manually started remote Java process - Attach type to profile remote Java process from its startup. Providing a hostname and target OS/JVM/architecture is required. Based on the target configuration the dialog shows steps and command line argument to configure the process for profiling.

How do I start and stop the profiler?

Once configured, the profiling session can be started by clicking the leftmost Profile/Attach button in Profile window toolbar. Profile button (Profile window opened using Profile action) starts the project and profiles it. Attach button (Profile window opened using Attach action) will optionally request some attach information (PID, target host/OS etc.) if not already set up and then connects to the target process.

The profiling session can be stopped using the red Stop button next to the Profile/Attach button. The session will be also finished by closing the Profiler window or by launching a new profiler session. If the session started the profiled project, Stop action terminates also the profiled process. If the profiler attached to an already running/started process, the process will be left running after terminating the profiling session.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo