DTrace GUI Plug-in
By Nasser Nouri, Sun Microsystems, July, 2008
This article describes how to download, install, and run the
Dynamic Tracing (DTrace) GUI Plugin. The NetBeans DTrace GUI Plugin
is a graphical user interface
for SolarisTM Dynamic Tracing (DTrace), and can be installed into the
SunTM Studio IDE, NetBeansTM
IDE 6.0, NetBeans IDE 6.1, and NetBeans IDE 6.5.
You can run D scripts from the
GUI, even those that are embedded in shell scripts. In fact, the DTrace
GUI Plugin 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.
You can visualize the output of DTrace using Chime.
Chime is a graphical tool for visualizing DTrace
particular, its ability to display data over time adds a missing
dimension to system observability. Chime is fully integrated with the
NetBeans DTrace GUI Plugin.
An important feature of Chime is the ability to add
without recompiling. Displays are described in XML. A placeholder
syntax allows DTrace program values to be substituted behind the
scenes, enabling the user of Chime to select from a described range of
program modifications without having to know about DTrace. The
resulting modified programs are displayable, making the tool
educational as an added benefit. Chime can function as a toolkit of
canned displays, but also leverages some of the dynamic potential of
DTrace to answer unanticipated questions prompted by the current
The NetBeans DTrace GUI Plugin is architected in such a way that
you can easily extend and customize it.
The GUI package consists of two components: The NetBeans plugin
(includes Chime) and
the DTraceScripts directory.
The NetBeans DTrace GUI Plugin can be installed easily into the
Studio IDE, NetBeans IDE 6.0, NetBeans
IDE 6.1, or NetBeans IDE 6.5.
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. Chime displays are included in the DTraceScripts directory.
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,
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 GUI plug-in is supported only on the SolarisTM
10 08/07 Operating System and later Solaris 10 OS updates, and the OpenSolarisTM Operating
- The NetBeans DTrace GUI Plugin runs with both the Sun Studio IDE
- NetBeans IDE 6.0, NetBeans IDE 6.1, or NetBeans IDE 6.5 can
be downloaded from https://netbeans.org/
- The Sun Studio IDE can be downloaded from http://developers.sun.com/sunstudio/downloads/
The Rules of Engagement
- 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:
You have to log out from your system completely. These
privileges take effect when you log in to the system.
User privileges are described in the security section of the
DTrace with Sun Studio Tools to Understand, Analyze, Debug, and Enhance
- If you have given yourself the Primary Administrator or root
the DTraceScripts directory will be installed in root directory. See
the example below:
- Remove or rename the DTraceScripts directory if it is already
installed from the previous releases of the DTrace GUI Plugin.
- The DTraceScripts directory will be installed automatically
during the installation of the DTrace GUI Plugin.
- If you will be running the IDE as yourself, the DTraceScripts
directory will be installed in your home
($HOME) directory. If you will be running the IDE as root, the DTraceScripts
directory will be installed in the root directory.
How to Install the NetBeans DTrace GUI Plugin
- Start up NetBeans IDE or Sun Studio IDE.
- Choose Tools > Plugins.
- On the Available Plugins tab of the Plugins window, click the
DTrace to add a checkmark. (If DTrace does not appear in the available
list, click Reload Catalog and try again.) Click Install.
- In the NetBeans IDE Installer window, click Next.
- Accept the License Agreement and click Install.
- Click Finish.
- Close the Plugins window.
The NetBeans DTrace GUI Plugin is now installed into the NetBeans IDE or Sun
Your installation of the DTrace GUI Plugin is now complete. To open the
GUI, choose Window > DTrace.
The DTrace GUI Plugin is also available for download from
How to Run the D Scripts in DTrace GUI Environment
To run D scripts in the DTrace GUI:
- Start up the Sun Studio IDE, or NetBeans IDE.
- Choose Windows > DTrace. The DTrace tab opens on the left side
of the IDE.
- Select the Toolkit tab. Select a D script from the Category list box
in the DTrace panel
and click Start.
- The output of the selected D script is displayed in the Output
window. Some scripts do not generate any output until you click Stop
- You can run multiple D scripts simultaneously.
- Clicking Re-Run (green icon) runs the D script in the same Output tab.
- Clicking Stop (red icon) stops the D script that is
- To save the output of a script, right-click in the Output window
and choose Save As.
View, Edit, or Create a New D Script
You can double clicks on a D script to display the selected D script in
the Editor window. Or you may right click on the selected D script and
choose the View/Edit option from the Popup menu to display the D script
in the Editor window.
To create a new D script:
- Click New Script.
- In the New Script dialog box, type the name of the new D script.
The empty D script will be created
in the selected category (directory). The following example
shows how to create an empty hello
D script in the Proc directory.
(empty) hello.d script appear in the Editor window.
- Enter the code for new D script in the Editor window and save
the file. The following example shows the DTrace code for the hello.d
You can run the newly created hello.d script from the
The configuration panel lists optional parameters that
you can specify for each selected D script.
||The process-id of the running
||The D script arguments
||The absolute path name to the
||The executable arguments
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 following example shows how to run the memleak.d
memleak.d script can be used to detect memory leaks in
memleak.d script requires two parameters: The absolute path
name to the
executable and the D script module name. In the example,
/home/nassern/test/umem/hello is the absolute path name to the
executable and libc is the module name.
DTrace Output Visualization with Chime
Chime is a graphical tool for visualizing DTrace aggregations. It
displays DTrace aggregations
using bar charts and line graphs.
By default, Chime provides twelve display traces that can be
selected from the list menu. The display
traces can be used to monitor both the behavior of the Solaris kernel
and applications that are currently running on the system. Users can
visualize performance of functions that are defined in an application
they can visualize the kernel activities such
as interrupt statistics, system calls, kernel function calls, and
One of the most useful features of Chime is ability to turn on
recording while DTrace is collecting data about the application and the
system. The recorded data can be played back at a later time to
the cause of failure or performance degradation. The recorded data can
be sent to other users who have access to NetBeans DTrace GUI Plugin
or Chime for further investigation.
Steps to visualize the output of DTrace aggregations:
- Select Chime tab.
- Select a display from the list of traces and press the Run button.
Adding New Chime Displays
An important feature of Chime is the ability to add new displays
without re-compiling. A new display can easily be created by using
Chime Display Wizard
Simply, click on the Create a New Display icon to invoke the New
Display Wizard. The New Display Wizard will guide you through steps to
create a new display.
Drilldown lets you answer questions about values of interest. For
example, for a selected executable you could get a breakdown of its
system calls by function. Click here
to continue this walk-through by adding drilldown to your new display.
List Probes Window
Users can query for the list of available Providers, Modules,
or Probes using the List Probes window. To open the List Probes window, click
the List DTrace Probes icon.