PREFACE
DTrace allows illumos developers and administrators to:
• Implement custom scripts that use the DTrace facility
• Implement layered tools that use DTrace to retrieve trace data
This guide will teach you everything you need to know about using DTrace. Basic familiarity with a
programming language such as C or a scripting language such as awk(1) or perl(1) will help you learn
DTrace and the D programming language faster, but you need not be an expert in any of these areas. If you
have never written a program or script before in any language, the section called “Related Information”
provides references to other documents you might find useful.
How This Book Is Organized
Chapter 1 provides a whirlwind tour of the entire DTrace facility and introduces readers to the D program-
ming language. Chapter 2, Chapter 3, and Chapter 4 then discuss the fundamentals of D in greater detail,
and explain how D programs are converted into dynamic instrumentation. This initial group of chapters
should be read first by all readers.
Chapter 5, Chapter 6, Chapter 7, and Chapter 8 discuss the remaining D language features, most of which
will be familiar already to C, C++, and Java
™
programmers. Readers who are unfamiliar with any of these
languages should read these chapters; more experienced programmers may wish to proceed directly to
later chapters.
Chapter 9 and Chapter 10 discuss DTrace’s powerful primitive for aggregating data and the set of built-in
actions that can be used to build tracing experiments. All readers should carefully read these chapters.
Chapter 11 describes the DTrace policies for buffering data and how these can be configured. This chapter
should be read by users once they are familiar with constructing and running D programs.
Chapter 12 describes the D output formatting actions as well as the default policy for formatting trace
data. Readers who are familiar with the C
printf
function can rapidly skim this chapter. Readers who
have never seen printf before should read this chapter carefully.
Chapter 13 discusses the DTrace facility for speculatively committing data to a trace buffer. This chapter
should be read by users who need to use DTrace in a situation where data must be traced prior to
understanding whether it is relevant to the question at hand.
Chapter 14 provides a complete reference for the
dtrace
command-line utility, similar to the corresponding
on-line manual page. Readers may wish to refer to this chapter when various command-line options are
presented elsewhere in the book. Chapter 15 then discusses how the
dtrace
utility can be used to construct
executable D scripts and process their command-line arguments, and Chapter 16 describes the options that
can be tuned on the command-line or from within a D program itself.
The group of chapters beginning with Chapter 17 and ending with Chapter 32 discuss the various DTrace
providers that can be used to instrument various aspects of the illumos system. All readers should skim
these chapters to familiarize themselves with the various providers, and then return back to read particular
chapters in detail as needed.
Chapter 33 discusses examples of using DTrace to instrument user processes. Chapter 34 describes how
application programmers can add customized DTrace providers and probes to user applications. Readers
who are user program developers or administrators and wish to use DTrace to investigate user process
behavior should read these chapters.
xiv