Documentation Contents

Java VisualVM - Profiling Applications

Java VisualVM presents data for local and remote applications in a tab specific for that application. You can have multiple application tabs open. Each application tab contains sub-tabs that display different types of information about the application.

Profiling applications

The Profiler tab of an application enables you to start and stop the profiling session of a local application. Profiling results are displayed in the Profiler tab. You can use the toolbar to refresh the profiling results, invoke garbage collection and save the profiling data.

By default the profiling tool is not running until you are ready to profile the application. You can choose from the following profiling options:

When you start a profiling session, Java VisualVM attaches to the local application and starts collecting profiling data. When profiling results are available they are automatically displayed in the Profiler tab.

Using the toolbar

You can use the following buttons in the Profiling Results toolbar to work with profiling results:

Filtering profiling results

The filter box below the profiling results enables you to filter the displayed results according to the name of the method. To filter the results, enter a term in the method name filter box, select which filtering method to use and press Return. You can see and select previous filter terms by clicking the arrow to the right of the method name filter box.

Modifying profiling settings

The Java VisualVM profiling tool supplies default settings for profiling applications. You can view the default settings by selecting the Settings checkbox in the Profiler tab. You can modify the profiling settings when no profiling session is in progress.

CPU Profiling

This profile command returns detailed data on method-level CPU performance (execution time), showing the total execution time and number of invocations for each method. When analyzing application performance, Java VisualVM instruments all of the methods of the profiled application. Threads emit the "method entry" event when entering a method and generate the corresponding "method exit" event when exiting the method. Both of these events contain timestamps. This data is processed in real time.

Screenshot of Profiler tab showing CPU profiling results

screenshot of Profiler tab showing CPU profiling

Screenshot of Profiler tab showing CPU profiling settings

screenshot of Profiler tab showing CPU profiling

Memory Profiling

When you analyse memory usage, Java VisualVM starts instrumenting the loaded classes and displays the total number of objects allocated by each class (including array classes) in a table. For each class currently loaded class in the Java Virtual Machine (JVM), the profiling results display the size and number of objects allocated since the profiling session started. The results are automatically updated as new objects are allocated and as new classes are loaded.

Java VisualVM displays the number of objects as an absolute number and as a percentage. The bytes allocated are also displayed as a graph representing the percentage of bytes as well as the total number of bytes allocated by each class.

Screenshot of Profiler tab showing memory profiling results

screenshot of Profiler tab showing memory profiling

Screenshot of Profiler tab showing memory profiling settings

screenshot of Profiler tab showing memory profiling settings

Taking Profiler Snapshots

Java VisualVM enables you to take profiler snapshots to capture the results of a profiling session. A profiler snapshot captures the results at the moment the snapshot is taken. To take a snapshot, click the Take Snapshot of Collected Results button in the toolbar while a profiling session is in progress. When you take the snapshot, the snapshot opens as a tab in the application tab. A node for the snapshot also appears under the application node in the Applications window.

Screenshot of memory profiling snapshot

screenshot of memory profiling snapshot

Screenshot of CPU profiling snapshot

screenshot of CPU profiling snapshot

For more about profiler snapshots, see the following document:


Oracle and/or its affiliates Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.
Contact Us