FeaturesPluginsDocs & SupportCommunityPartners

NetBeans DTrace GUI Plug-in


This article describes how to download, install, and run the NetBeans Dynamic Tracing (DTrace) GUI plug-in. The NetBeans DTrace GUI plug-in is a Graphical User Interface (GUI) for running DTrace scripts, and can be installed into the SunTM Studio 12 IDE, NetBeansTM IDE 5.5, NetBeans IDE 5.5.1, and NetBeans IDE 6.0.

You can run D scripts from the GUI, even those that are embedded in shell scripts. In fact, the DTrace GUI plug-in runs all of the D scripts that are packaged in the DTraceToolkit. The DTraceToolkit is a collection of useful documented scripts developed by the OpenSolaris DTrace community.

The NetBeans DTrace GUI plug-in is architected in such a way that you can easily extend and customize it.

The GUI package consists of two components: The NetBeans plug-in and the DTraceScripts directory.

  • The NetBeans DTrace GUI plug-in can be easily installed into Sun Studio 12 IDE, NetBeans IDE 5.5, NetBeans IDE 5.5.1, or NetBeans IDE 6.0.

  • The DTraceScripts directory contains several subdirectories. Each subdirectory contains several D scripts. The D scripts are categorized mostly based on DTrace providers. You can copy a new D script to an existing subdirectory from the shell command line, you can copy it into a newly created subdirectory in the DTraceScripts directory. You can also create and save a new D script from within the IDE.

What is DTrace?

DTrace is a comprehensive tracing facility built into the SolarisTM Operating System that can be used by developers and administrators on live production systems to examine the behavior of both user programs and of the operating system itself.

DTrace enables you to explore your system to understand how it works, track down performance problems across many layers of software, or locate the cause of aberrant behavior.

DTrace helps you understand a software system by enabling you to dynamically modify the operating system kernel and user processes to record additional data that you specify at locations of interest, called probes.

A probe is a location or activity to which DTrace can bind a request to perform a set of actions, like recording a stack trace, a timestamp, or the arguments to a function.

Probes are like programmable sensors scattered all over your Solaris system in interesting places. If you want to figure out what's going on, you use D scripts to program the appropriate sensors to record the information that is of interest to you. Then, as each probe fires, DTrace gathers the data from your probes and reports it back to you.

For more information, see Observability

System and Software Requirements and Downloads

The system and software requirements are listed below:
  • The DTrace utility is supported only on the SolarisTM 10 and Solaris 11 Operating Systems.
  • The NetBeans DTrace plug-in runs with both the Sun Studio 12 IDE and NetBeans IDE.
  • The NetBeans IDE 5.5, NetBeans IDE 5.5.1. or NetBeans IDE 6.0 can be downloaded from http://www.netbeans.org/ web site.
  • The Sun Studio 12 IDE can be downloaded from http://developers.sun.com/sunstudio/downloads/ web site.
  • Your privileges need to be set in the /etc/user_attr file. For example, the following is how DTrace privileges are set in the machines on which I run DTrace:
    nassern::::defaultpriv=basic,dtrace_user,dtrace_proc,dtrace_kernel

    These privileges take effect when you log in to the machine.

User privileges are described in the security section of the article Using DTrace with Sun Studio Tools to Understand, Analyze, Debug, and Enhance Complex Applications.

How to Install the NetBeans DTrace GUI Plug-in

Installation steps for NetBeans IDE 5.5, NetBeans IDE 5.5.1, and Sun Studio 12 IDE

  1. Start up NetBeans IDE 5.5, NetBeans IDE 5.5.1, or Sun Studio 12 IDE.

  2. Choose Tools > Update Center.

  3. On the Select Location of Modules page of the Update Center Wizard, if the checkbox for NetBeans Update Center Beta (for NetBeans IDE 5.5 or NetBeans IDE 5.5.1) or the checkbox for Sun Studio Update Center (for Sun Studio 12 IDE) does not contain a checkmark, click the checkbox. Then click Next.

  4. Select Location of Modules page

  5. On the Select Modules to Install page, select DTrace in the Available Updates and New Modules list, and click Add. Then click Next.

  6. Select Modules to Install page

  7. Accept the license agreement.

  8. On the Download Modules page, click Next when the download is complete.

  9. Download Modules page

  10. On the View Certificates and Install Modules page, click Finish.


  11. View Certificates and Install Modules page

The NetBeans DTrace GUI plug-in is now installed into NetBeans IDE 5.5 or NetBeans IDE 5.5.1. See Installing the DTraceScripts File to install the DTraceScripts file.

Installation steps for NetBeans IDE 6.0

  1. Start up NetBeans IDE 6.0.

  2. Choose Tools > Plugins.

  3. On the Available Plugins tab of the Plugins window, click the checkbox for DTrace to add a checkmark. (If DTrace does not appear in the available plugins list, click Reload Catalog and try again.) Click Install.

  4. Available
Plugins tab

  5. In the NetBeans IDE Installer window, click Next.

    NetBeans
IDE Installer

  6. Accept the License Agreement and click Install.

  7. Click Finish.

  8. Close the Plugins window.

The NetBeans DTrace GUI plug-in is now installed into NetBeans IDE 6.0. See the next section to install the DTraceScripts file.

Installing the DTraceScripts File

If you will be running the IDE as yourself, the DTraceScripts.tar file needs to be installed in your home directory. If you will be running the IDE as root, the DTraceScripts.tar file needs to be installed in the root directory.

After you have installed the DTrace GUI plug-in, the DTraceScripts.tar file is in the .netbeans/netbeans_release directory or .sunstudio/12.0-SunOS-platform directory in your home directory. For example, /home/nassern/.netbeans/6.0/dtrace-gui-102007.

To install the DTraceScripts.tar file:

  1. In your home directory or root directory, untar the file. For example:
    tar -xvf /home/nassern/.netbeans/6.0/dtrace-gui-102007/DTraceScripts.tar
    
  2. The file permissions for all of the scripts need to be set to -rwxr-xr-x or 755. If necessary, use the UNIX chmod command to set the proper file permissions. For example:
    chmod -R 755 DTraceScripts

Your installation of the DTrace GUI is now complete. To open the DTrace GUI, choose Window > DTrace.

The DTrace GUI is also available for download from http://plugins.netbeans.org.

How to Run the D Scripts in DTrace GUI Environment

To run D scripts in the DTrace GUI:

  1. Start up the Sun Studio 12 IDE, NetBeans IDE 5.5, NetBeans IDE 5.5.1, or NetBeans IDE 6.0.

  2. Choose Windows > DTrace. The DTrace tab opens on the left side of the IDE.

  3. Select a D script from the Category list box in DTrace panel and click Start. See the screen shot below.

  4. The output of the selected D script is displayed in the Output window. Some scripts do not generate any output until you click Stop.


An example to show how to run D scripts

  • You can run multiple D scripts simultaneously.
  • Clicking Stop stops the last D script that you started.
  • To save the output of a script, right-click in the Output window and choose Save As.

Advanced Options

Click Advanced in the DTrace GUI to use the advanced options.

You can use the View/Edit option to display the selected D script in the Editor window.

To create a new D script:

  1. Click Advanced and select the Create new script option.

  2. In the New Script dialog box, type the name of the new D script without the .d extension. The empty D script will be created in selected category (directory). For example, the screen shot below shows how to create an empty hello D script in the Proc directory.

    create a new D script

  3. Click Advanced and select the View/Edit option to display the newly created (empty) D script in the Editor window.

  4. Enter the code for new D script in the Editor window and save the file. The screen shot below shows the DTrace code for the hello.d script.

    Create and run the new  hello.d script

You can run the newly created hello.d script from the DTrace GUI.

The configuration panel lists optional parameters that you can specify for each selected D script.

pid The process-id of the running process
Script args The D script arguments
executable The absolute path name to the executable
executable args The executable arguments
output Ignore this field
description The help messages can be inserted in this field

In order to create the persistent data, the user specified parameters or properties are stored in a .xml file. The property file has the same name as the D script file, with the exception .xml extension. In other words, the user data is preserved for the subsequent invocation of D scripts and the IDE itself.

The screen shot below shows how to run the memleak.d script. The memleak.d script can be used to detect memory leaks in applications. The memleak.d script requires two parameters: The absolute path name to the executable and the D script module name. In the example below, /home/nassern/test/umem/hello is the absolute path name to the executable and libc is the module name.



how to specify properties for a D script.

Limitations and Known Bugs

  • Currently, clicking Stop stops the last D script that has been started by user. This will be changed in the next release. The Stop action will halt the running script, that its output tab is selected by the user.
  • Double clicking on selected D script does not display the D script in Editor window. This will be fixed in the next release. Currently, you must use the Advanced View/Edit option to display the D script in the Editor window.

Please send your comments and feedback to .

Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by