Friday Aug 15, 2008

Guest Blogging

As part of the countdown to the creation of his 100th blog entry, Varun Nischal is inviting guests to post entries on his blogAdam Bien wrote entry number 80.  And now I have written entry number 85 on a new profiler feature in NetBeans 6.5 Beta.  Thanks, Varun!  :-)

Tuesday Jul 08, 2008

Java VisualVM

JDK 6 Update 7 has been released.  You can download the bits here.

This is the first JDK update from Sun that includes the new Java VisualVM tool.  Jarda and I talked about Java VisualVM at JavaOne this year during our presentation on monitoring/troubleshooting tools.

Well, Jarda did most of the talking - since he is actually working on the code he is the expert.  :-)

In any event, Java VisualVM is a new GUI-based tool for troubleshooting Java applications. It incorporates technology from multiple projects, including among others, jstack, JMX, and the NetBeans profiling tools, in order to provide one easy-to-use visual diagnostic tool for both development and production environments.

To me, that phrase "incorporates technology from multiple projects" is one of the most important parts of the story.  During our presentation, Jarda and I discussed twelve tools (the talk was broad, not deep).  Dealing with that many tools can be a pain, which is why it is nice that Java VisualVM includes functionality from so many of the different tools. 

The NetBeans IDE has had for many years some very powerful tools for profiling Java applications and now some of those tools are available outside of the IDE in Java VisualVM.  The user interface for those profiling tools, however, is a bit different in Java Visual VM.  This is not surprising, since Java VisualVM does not have access to the source code for the application when doing profiling.

For example, one of the standard demonstrations of the NetBeans profiling tools is to profile the Java2D application that is included in the JDK.  The profiler supports the concept of "root methods" which are starting points for doing the bytecode instrumentation necessary for collecting CPU performance data.  I typically choose all the methods in the java2d.demos.Colors.Rotator3D class. In the NetBeans IDE, the user interface is:


In Java VisualVM, however, you would instead use this portion of the profiler settings tab to type in the fully-qualified name of the class:


There are, of course, other differences as well.  For more information on Java VisualVM check out this features page.

One last thing: the NetBeans profiling tools require calibration data.  This data provides a baseline for the performance of the hardware that is being profiled.  If it does not find any existing calibration data (it looks for a .nbprofiler subdirectory in your home directory), Java VisualVM calculates the calibration data on first startup:


After it finishes, it will display this dialog:

Note the warning about CPU frequency switching.  If your system does dynamic CPU frequency switching, exit Java VisualVM, remove the .nbprofiler subdirectory and then restart Java VisualVM.  For those of you running on OpenSolaris, check out this blog entry and specify disable instead of enable.  Then do the calibration by restarting Java VisualVM.  After the calibration is done, switch the cpupm entry back to enable and re-run the pmconfig command.

Tuesday Jun 24, 2008

The Observatory

My job for the last few years has been to talk (in various forms: presentations, demos, screencasts, podcasts, articles, book chapters, blog entries, etc.) to software developers.  That is not going to change.  But as Roman has already pointed out, my focus is going to change.  Instead of concentrating on developer tools (primarily, the NetBeans IDE), I will instead spend my time working with the OpenSolaris operating system.  Specifically, on how software developers can better make use of OpenSolaris.

I will continue, of course, to be a user and proponent of NetBeans.  I expect I will write an occasional post on NetBeans and related topics.  But with my new assignment, I am moving my blogging activity away from my blog and over to In addition to this blog, I plan to post to The Observatory.


Gregg Sporar


« June 2016