Tuesday Nov 10, 2015

Profiling Live Process With NetBeans Profiler 8.1

This article is a modification of the Getting Started With NetBeans Profiler 8.1 guide describing how to connect and profile an already running Java process. See profiler documentation for details on configuring and running the profiler.

The profiler is able to connect to any local process running on Java 6+ and started by the same user who runs the NetBeans IDE, without any additional configuration of that process. When running on Microsoft Windows, the profiled process must not be a Windows Service and must run the same Java architecture as the NetBeans IDE (32bit→32bit, 64bit→64bit).

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. Start Sample Application:
Select the AnagramGame project node in Projects window and invoke the Run Project (AnagramGame) action either in the Run menu or the IDE toolbar. The action can also be invoked using the F6 shortcut. The project is started and Anagrams window opens. That's the running process to be profiled in the following steps.
3. Open Profiler Window:
Select the AnagramGame project node in Projects window and create a profiling session for this project by invoking the Attach to Project (AnagramGame) action either in the main IDE menu or the IDE toolbar. Profiler window representing new profiling session opens in the editor area. When profiling a process without the corresponding project, the Attach to External Process action needs to be used.
4. 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.
5. Select The Process:
Click the Attach button dropdown arrow and select the Setup Attach to Project... item to open the Attach Settings dialog. This dialog shows a list of all locally running Java processes available for profiling. The list of processes can be refreshed at any time using the Reload processes button at the bottom of the dialog. Selecting a process instructs the profiler to connect to this process each time the Attach button in Profiler window toolbar is pressed. In case the Always connect to <process> option is selected, the list shows just the processes with the selected class name. In case there's exactly one such process available for profiling, the profiler will attach to it automatically even if its process ID differs from the selected one. See Profiling Local Running Process docs for details on selecting the process to be profiled.
6. Start Collecting Data:
Start the profiling session by clicking the Attach button in the Profiler window toolbar. This action connects the profiler to the running process and starts profiling it. Based on the profiler mode selected in step 6. you'll see the profiling data being collected. In case the process to be profiled isn't set up correctly, the Attach Settings dialog described in the previous step is displayed and you have to select the right process for profiling.
7. Switch Profiler Mode:
Modify the profiling mode on the fly while the profiled application is running by clicking the Attach 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.
8. Finish Profiling Session:
Finish the profiling session by clicking the Finish profiler session button in the Profiler window toolbar. This action detaches the profiler from the profiled process without terminating it 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).
9. Restore Profiling Session:
Close the Profiler window and/or restart the NetBeans IDE. Create a new profiling session for the Anagram Game project or External Process and note that all the settings have been persisted for the project/process from the previous session, including the attach settings. If the previously selected process to attach is still running, it will be automatically reused for the new profiling session.

Congratulations, you've just learned how to profile an already running Java process with the new NetBeans profiler!

Friday Nov 06, 2015

Getting Started With NetBeans Profiler 8.1

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!

Wednesday Nov 04, 2015

NetBeans Profiler 8.1 Released

NetBeans IDE 8.1 include a reworked Java profiler which provides simplified user interface, improved profiling views and optimized engine.

The profiler now uses a single window which contains controls to configure and control the profiling session and display the collected results. The session is configured by selecting a profiling mode using the Profile dropdown menu and started by clicking the Profile button without providing any special settings. If needed, the settings can be tweaked using the Settings pane displayed on demand above the profiling results.


Methods profiler introduces live forward and reverse call trees in addition to the live hot spots view. The data may be filtered or aggregated by selected threads and can be displayed as absolute or incremental values.


Objects profiler displays live allocation call trees if configured and is able to profile instances of just the selected classes, lowering the profiling overhead and amount of collected data.


Telemetry profiler introduces monitoring CPU utilization and GC overhead, Threads profiler adds filtering capabilities to the timeline view. The profiler newly supports taking thread dumps from the profiled application.


Attaching to already running processes has been significantly improved both on the UI and engine side. The profiler now displays all processes available for attach in a table and remembers the selected process between profiling and/or IDE sessions.

Visit http://profiler.netbeans.org to see detailed list of news and changes, read profiler documentation and download NetBeans IDE 8.1 including the profiler.

Monday Mar 07, 2011

VisualVM 1.3.2 Released

VisualVM 1.3.2 has been released and is available for download at http://visualvm.java.net. VisualVM 1.3.2 delivers several bugfixes (especially for JDK 7) and necessary updates caused by dev.java.net migration to Kenai. See the Release Notes for list of all changes.

Monday Sep 20, 2010

VisualVM 1.3.1 Released

VisualVM 1.3.1 has been released and is available for download at https://visualvm.dev.java.net. The new version is built on the NetBeans Platform 6.9.1 and delivers number of bugfixes. See the Release Notes for more details.

Monday Jul 26, 2010

VisualVM 1.3 Released

The new version of the VisualVM tool is now available at https://visualvm.dev.java.net. VisualVM 1.3 introduces several new features and improvements, extends the API for plugins and fixes many bugs. Details of the changes can be found in the Release Notes. Let's look at the most interesting new features in more detail:

Sampler In The Core Tool

The sampling profiler that was originally provided as a plugin has now been integrated into the core tool. Sampler provides a lightweight and safe way to determine performance bottlenecks and memory problems and adds minimal overhead to the target application. It can be used for local and remote applications running on JVMs from different vendors and is designed to be used in production environments. Once a problem is identified, it can be further analyzed in detail using the instrumenting Profiler with appropriate settings (profiling roots, instrumentation filter). Profiler is available for local applications running on an Oracle/Sun-compatible JDK and is mostly intended as a profiling tool for Java developers.

Sampler And Profiler Presets

All the Sampler and Profiler settings can now be saved into presets and reused for further application/VisualVM sessions. This makes it much easier for developers to analyze and improve applications using the iterative profile-fix-restart approach. Moreover, a preset can be selected automatically for an application based on its main class or display name.

Remote Heap Dumps

In previous releases, the VisualVM was only able to take heap dumps of applications that were running locally. The only way to dump the heap of a remote application was by using the MBeans plugin and invoking the appropriate MBean operation (com.sun.management.HotSpotDiagnostic | Operations | dumpHeap). Starting with VisualVM 1.3, you can now use the Heap Dump actions and buttons in the tool to take a heap dump of applications that are running remotely. When invoked, a dialog is displayed that enables you to specify the full path on the remote system where you want to dump the heap. After the heap dump is created, you need to manually copy the file to your local machine and use the Load action to open and analyze the file using VisualVM.

Monitoring Remote Hosts

In every release of VisualVM it is possible to open the Local system node in the Applications view and see the machine setup (OS, architecture, number of processors etc.), actual CPU load (not available for Windows OS) and physical & swap memory usage. VisualVM 1.3 enables you to obtain this information for remote hosts as well if the host has at least one JMX-enabled application defined in VisualVM. The data is obtained using the application's JMX connection. If the "proxy" application finishes, the live data will freeze and will be updated again when another JMX-enabled application becomes available on that host.

Sorting Hosts, Applications, Coredumps And Snapshots

By default, all nodes are sorted by the insertion time. This means that the last discovered application is added to the end of the list of running applications. In VisualVM 1.3 you can newly sort applications also according to their display name or process ID, which simplifies monitoring systems that are running many Java applications. The other nodes can now be sorted either by the insertion time or by display name.

Tracer Framework And Probes

Tracer is a new framework and GUI for monitoring and analyzing Java applications. Using various types of probes, Tracer gathers metrics from an application and displays the data in a timeline. This gives a quick overview of what is happening in various parts of the application and allows you to easily determine the relations between the metrics. The values are displayed both graphically and in a table and can be exported to common formats for further processing with external tools. VisualVM 1.3 comes with several sets of Tracer probes that are distributed as plugins: Monitor Probes, JVM Probes, Jvmstat Probes, Swing Probes, JavaFX probes and DTrace Probes.

Threads Inspector Plugin

The Threads Inspector integrates with the Threads tab and allows you to analyze the stack trace(s) of one or more selected threads directly without requiring you to take and open full thread dumps. This is extremely useful when you need to quickly analyze various threading problems.

Recognizing Alternative JVM Languages

Some developers use VisualVM as a monitoring and profiling tool for alternative JVM languages that do not have dedicated tooling. VisualVM now recognizes the Clojure, Groovy, JRuby, Jython and Scala runtimes, enabling these developers to easily find the appropriate processes.

Built On NetBeans Platform 6.9

VisualVM 1.3 uses the most recent NetBeans Platform and profiler release to ensure the best performance and greatest stability. The HeapWalker now displays local variables in the Threads section of the Summary | Overview view, providing a better context for the state of the heap at the time the heap dump is created.

VisualVM 1.3 is available for download at https://visualvm.dev.java.net. You can send your comments to the VisualVM developers by using the feedback mailing list. The API documentation can be found here.

Friday Jul 09, 2010

JDK 6 Update 21 Includes VisualVM 1.2.2

The latest JDK 6 Update 21 from Oracle includes VisualVM 1.2.2, the most recent VisualVM tool version. The list of changes is available in VisualVM 1.2.2 Release Notes or in JDK 6u21 Release Notes.

The most visible change in the new Java VisualVM is Oracle rebranding which includes new splash screen and About dialog graphics, and a slightly redesigned Start Page.

Wednesday Jun 23, 2010

NetBeans IDE 6.9 Released

NetBeans IDE 6.9 has been released last week. You can download it from NetBeans site. News in this release are listed in NetBeans IDE 6.9 Release Information and you can also watch some of the new features in NetBeans 6.9 Overview video.

NetBeans Profiler has enhanced HeapWalker. Thread dump in the overview part of HeapWalker was extended to display information about local variables, which are temporary GC roots. it is possible to navigate from a local variable to its corresponding instance in the instance view and from Java Frame GC root in references view to a corresponding local variable in the thread dump. This enhancement should help users to match Java Frame GC roots to a corresponding local variable.

  

The list of bug fixes in NetBeans Profiler 6.9 is available here.

Friday Apr 30, 2010

Problems Adding Remote Hosts in VisualVM on Linux/Solaris

Some problems have been identified in VisualVM when running on Linux or Solaris using OpenJDK or JDK 7. Due to a JDK bug in GTK LaF implementation it's not possible to open the Host customizer in VisualVM 1.2 and newer. This affects the 'Add Remote Host' and 'Host Properties' actions which throw a java.lang.NullPointerException and don't allow to edit and/or add hosts. Details are available in the VisualVM Troubleshooting Guide.

There's an easy workaround to this problem, the VisualVM can be configured to use a different look'n'feel: visualvm --laf Nimbus or visualvm --laf Metal. The LaF to be used can be configured permanently in visualvm/etc/visualvm.conf configuration file. Another possibility is to run the VisualVM using Sun JDK 6.

The problem is now resolved on VisualVM side in development builds and will be available in the next release.

Wednesday Jan 27, 2010

Oracle Plans for NetBeans IDE

This is how Oracle sees the NetBeans future in context of the other supported IDEs, as presented in Oracle + Sun Strategy Update Webcast held on January 27th, 2010:

  • NetBeans continues as Lightweight IDE for Java Developers
    • Focus on Java EE6, Java ME, and Scripting
    • Increased focus on Mobile Development and Scripting with Dynamic Languages
    • Hudson continues as Open Source Continuous Build solution

  • Oracle JDeveloper continues as Oracle's Strategic Development Tool
    • Integrated Development Environment for Oracle Fusion Middleware
    • Strategic Development Tool for Oracle's Applications including Fusion Applications

  • Oracle continues Eclipse contributions
    • Oracle is a Strategic Member of Eclipse
    • Continued delivery of new features in Oracle Enterprise Pack for Eclipse 11g

Update: More details on the NetBeans future are available in the Oracle Developer Tools Software Strategy Webcast.

Wednesday Jan 13, 2010

JDK 6 Update 18 Includes VisualVM 1.2.1

The latest Sun JDK 6 Update 18 includes VisualVM 1.2.1 introducing many new features and improvements. The list of changes is available in VisualVM 1.2.1 Release Notes or in JDK 6u18 Release Notes.

Wednesday Jan 06, 2010

VisualVM 1.2.2 Released

VisualVM 1.2.2 has been released and is available for download at https://visualvm.dev.java.net. The new version upgrades the underlying framework to the NetBeans Platform 6.8 and delivers several performance improvements and bugfixes. See the Release Notes for more details.

Monday Nov 09, 2009

VisualVM 1.2.1 Released

VisualVM 1.2.1 has been released to fix compatibility issues with JDK 6 Update 17 (and newer) and several other problems:

  • Issue 333: HeapWalker in VisualVM doesn't work with JDK 6 Update 17+
  • Issue 327: Maximum value in Monitor charts is Integer.MAX_VALUE
  • Issue 332: NPE in VisualVM-Sampler

See the Release Notes for more details. VisualVM 1.2.1 can be downloaded at https://visualvm.dev.java.net.

Wednesday Oct 21, 2009

VisualVM 1.2 Released

New version of the VisualVM tool has been released. VisualVM 1.2 introduces many new features and improvements, extends the API for plugins and fixes many bugs.

  

These are some of the new features as mentioned in the Release Notes:

  • Sampling CPU and Memory profiler plugin
  • Support for multiple jstatd connections on a single local/remote host
  • New charts with dynamic tooltips, public Charts API for plugins
  • Monitor and Threads tab are saved into Application Snapshot
  • Properties UI for Applications, Hosts and Snapshots, public Properties API for plugins
  • Customizable proxy settings in Options dialog
  • UI for customizing SSL certificates in Options dialog
  • Built on NetBeans Platform & profiler 6.7.1:
    • Exporting profiler snapshots to HTML, XML and CSV
    • Computing retained size in HeapWalker
    • OQL scripting support in HeapWalker
    • Thread stack traces at the heap dump in HeapWalker
    • Improved appearance on Mac OS X

VisualVM 1.2 can be downloaded at https://visualvm.dev.java.net. Feedback to VisualVM developers can be sent using this mailing list. The API documentation can be found here.

Monday Oct 05, 2009

VisualVM 1.2 Test Build Released

VisualVM 1.2 Test Build has been released at https://visualvm.dev.java.net. The developers are asking the community to help with stabilizing the release by downloading the Test Build, trying out the new features and providing feedback at feedback@visualvm.dev.java.net or filing bug reports into the Issue Tracker.

The major new features in VisualVM 1.2 will include a sampling CPU and memory profiler, enhanced support for jstatd connections, redesigned charts and much more. Details about the release with a more detailed list of improvements are available in the Release Notes document.

About

A blog by NetBeans Profiler & VisualVM developers.

Search

Archives
« May 2016
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today