Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

DTrace Features

DTrace features[2] include the following.

[2] This feature list is from Dynamic Instrumentation of Production Systems (Cantrill, Shapiro, and Leventhal, 2005).

  • Dynamic instrumentation: Performance will always take a hit with static instrumentation, even when probes are disabled. To achieve the zero probe effect required for production systems, DTrace can also use dynamic instrumentation. When DTrace is not in use, there is absolutely no effect on system performance.

  • Unified instrumentation: Beyond requiring different tools for different aspects of the operating system, earlier approaches also required different tools for the operating system vs. applications. DTrace can dynamically instrument both user- and kernel-level software and can do so in a unified manner whereby both data and control flow can be followed across the user/kernel boundary.

  • Arbitrary-context kernel instrumentation: DTrace can instrument virtually all of the kernel, including delicate subsystems such as the scheduler and synchronization facilities.

  • Data integrity: DTrace reports any errors that prevent trace data from being recorded. If there are no errors, DTrace guarantees data integrity; recorded data cannot be silently corrupted or lost.

  • Arbitrary actions: Because it is dynamic, the actions taken by DTrace at any given point of instrumentation are not defined or limited a priori. You can enable any probe with an arbitrary set of actions.

  • Safety: DTrace guarantees absolute safety of user-defined actions: Runtime errors such as illegal memory accesses are caught and reported. Indeed, safety was central to the design of DTrace from its inception, given that the target environment for using DTrace are production systems.[3] In addition to runtime checking of user-defined actions, DTrace includes a watchdog timer, verifying that the target system is reasonably alive and responsive, and includes other safety mechanisms.

    [3] Of course, DTrace can be used across the entire system’s spectrum—development, QA, test, and so on.

  • Predicates: A logical predicate mechanism allows actions to be taken only when user-specified conditions are met. Unwanted data is discarded at the source—never retained, copied, or stored.

  • A high-level control language: DTrace is equipped with an expressive C-like scripting language known as D. It supports all ANSI C operators, which may be familiar to you and reduce your learning curve, and allows access to the kernel’s variables and native types. D offers user-defined variables, including global variables, thread-local variables, and associative arrays, and it supports pointer dereferencing. This, coupled with the runtime safety mechanisms of DTrace, means that structure chains can be safely traversed in a predicate or action.

  • A scalable mechanism for aggregating data: Data retention can be further minimized by statistical aggregation. This coalesces data as it is generated, reducing the amount that percolates through the framework by a factor of the number of data points. So, instead of handing a large quantity of data to user-land software for summarization, DTrace can perform certain summaries in the kernel.

  • Speculative tracing: DTrace has a mechanism for speculatively tracing data, deferring the decision to commit or discard the data to a later time. This eliminates the need for most postprocessing when exploring sporadic aberrant behavior, such as intermittent error events.

  • Heterogeneous instrumentation: Where tracing frameworks have historically been designed around a single instrumentation methodology, DTrace is extensible to new instrumentation problems and their solutions. In DTrace, the instrumentation providers are formally separated from the probe processing framework by a well-defined API, allowing fresh dynamic instrumentation technologies to plug in to and exploit the common framework.

  • Scalable architecture: DTrace allows for many tens of thousands of instrumentation points (even the smallest systems typically have on the order of 30,000 such points) and provides primitives for subsets of probes to be efficiently selected and enabled.

  • Virtualized consumers: Everything about DTrace is virtualized per consumer: Multiple consumers can enable the same probe in different ways, and a single consumer can enable a single probe in different ways. There is no limit on the number of concurrent DTrace consumers.

  • Privileges: DTrace is secure. By default, only the root user (system administrator) has the privileges required to use DTrace. In Solaris, the Process Rights facility can be configured to allow DTrace to be used by nonroot users. This is covered in more detail in Chapter 11, Security.


You are currently reading a PREVIEW of this book.


Get instant access to over $1 million worth of books and videos.


Start a Free Trial

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint