I’m a swiss Master student in Computer Science. I’m very interested in C++, open source projects, Linux, Intel Assembly and Agile. I'm currently working on Eddi, a new programming language that I created to improve my skills in C++. I've also worked a lot on Java technologies (Sprint, Osgi, Play!, ...), but I'm not currently working with Java anymore. Baptiste is a DZone MVB and is not an employee of DZone and has posted 51 posts at DZone. You can read more from them at their website. View Full User Profile

Discover Java VisualVM 1.3

08.17.2010
| 13311 views |
  • submit to reddit

A while back Java VisualVM 1.3 was released. We’ll see what’s new with this release. At this time, there is no package for Ubuntu, so we’ll install it manually :

wget https://visualvm.dev.java.net/files/documents/7163/151728/visualvm_13.zip
unzip visualvm_13.zip

And then we can directly launch it :

cd visualvm_13/bin
sh visualvm

You’ll be asked for the license agreement and after that the tool is launched :

VisualVM 1.3 Startup

VisualVM 1.3 Startup

Here there is nothing new, except for the change of version. So let’s profile something. In my case, I profiled IntelliJ Idea for the test. We immediately see that there is a new tab (Sampler). If we watch the three first tabs (Overview, Monitor and Threads), we see that there is no changes.

The Sampler tab is simply a plugin (VisualVM Sampler Plugin) that has been integrated by default in VisualVM. Sampling is not like profiling. There is no instrumentation, so no setup time and almost no overhead, the application runs at full speed. This is achieved by periodically polling the monitored application for thread dumps or memory histograms. So let’s test the Sampler tab :

VisualVM 1.3 Sampler

VisualVM 1.3 Sampler

Like, in the Profiler tab, we can launch CPU or Memory sampling. So let’s try CPU :

VisualVM 1.3 CPU Sampling

VisualVM 1.3 CPU Sampling

You will immediately see the speed of the results: there is no time to wait, but the refreshes are slower of course, because, it’s periodic. The results are like in the Profiler tab. If we start Memory Sampling :

VisualVM 1.3 Memory Sampling

VisualVM 1.3 Memory Sampling

Once again, the results are the same as with the Profiler, but we see a new feature, the PermGen histogram :

VisualVM 1.3 PermGen Histogram

VisualVM 1.3 PermGen Histogram

That could be really useful to see why your application takes up a lot of PermGen space or simply to see that there is not enough PermGen space.

There is another new feature in this version. The Tracer Probes. By default, there is no installed probes, so you must install plugins to see them :

VisualVM 1.3 Probes Plugins

VisualVM 1.3 Probes Plugins

Then, just click install, accept the license agreement and let the application restart. And then, if you launch the profiling of an application, you’ll see the Tracer tab :

VisualVM 1.3 Tracer

VisualVM 1.3 Tracer

You see that there is a lot of probes that we can enable. So let’s enable some probes and Start the Tracer :

VisualVM 1.3 Tracer Graphs

VisualVM 1.3 Tracer Graphs

Like the profiler, there some time needed for instrumentation and after that you will see some graphs. There is a graph for each probe you selected. Each probe displays some specific data, for example, the Threads Probe display the number of threads and the number of Deamon threads. The JIT Compiler Probe displays the activity of the JIT compiler. Here I’ve also enabled some Swing probes because IntelliJ Idea uses Swing. There are also Probes for JavaFX. If you pass the mouse on the graphs, you will see the exact values at the time where the cursor is :

VisualVM 1.3 Tracer Mouse Details

VisualVM 1.3 Tracer Mouse Details

It’s think this new Tracer is just awesome. It’s really useful and really good-looking.

So we’ve now covered the main new features of this new version. I think this version adds some great new features and improvements and that will make of VisualVM an essential profiler.

For the complete information about this new version, read the release notes.

From http://www.baptiste-wicht.com/2010/07/discover-java-visualvm-1-3/

Published at DZone with permission of Baptiste Wicht, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)