DTrace
From Siwiki
See also DTrace Topics
Solaris 10 delivered a revolutionary new subsystem called the Solaris Dynamic Tracing Framework (or DTrace for short). DTrace is an observability technology that allows us, for the first time, to answer virtually every question we ever wanted to ask about the behavior of our systems and applications.
Before Solaris 10, the Solaris observational toolset was already quite rich; many examples in this book use tools such as truss(1), pmap(1), pstack(1), vmstat(1), iostat(1), and others. However, as rich as each individual tool is, it still provides only limited and fixed insight into one specific area of a system. Not only that, but each of the tools is disjoint in its operation. It’s therefore difficult to accurately cor- relate the events reported by a tool, such as iostat, and the applications that are driving the behavior the tool reports. In addition, all these tools present data in different formats and frequently have very different interfaces. All this conspires to make observing and explaining systemwide behavioral characteristics very diffi- cult indeed.
Solaris dynamic tracing makes these issues a thing of the past. With one sub- system we can observe, quite literally, any part of system and application behav- ior, ranging from every instruction in an application to the depths of the kernel. A single interface to this vast array of information means that, for the first time ever, subsystem boundaries can be crossed seamlessly, allowing easy observation of cause and effect across an entire system. For example, requests such as “show me the applications that caused writes to a given device” or “display the kernel code path that was executed as a result of a given application function call” are now trivial to fulfill. With DTrace we can ask almost any question we can think of.
With DTrace we can create custom programs that contain arbitrary questions and then dynamically modify application and kernel code to provide immediate answers to these questions. All this can be done on live production environments in complete safety, and by default the subsystem is available only to the superuser (uid 0). When not explicitly enabled, DTrace has zero probe effect and the system acts as if DTrace were not present at all.
DTrace has its own scripting language with which we can express the questions we want to ask; this language is called “D.” It provides most of the richness of “C” plus some tracing-specific additions.
Futher information on DTrace is available from:
- A Tutorial on Dynamic Tracing, Chapter 10 from Solaris Performance and Tools
- Examples of applying DTrace, Chapter 1-9 of Solaris Performance and Tools
- Examples of applying DTrace from Solaris Internals
- Dynamic Tracing Guide available at http://docs.sun.com.
- The DTrace Topics wiki hosted here.
