1.1 About Using this Tutorial

This tutorial includes a variety of DTrace scripts and describes different ways in which you can use DTrace. Most of the examples have additional exercises that offer further practice in using DTrace. Each exercise provides an estimate of the time that you should allow to complete it. Depending on your level of programming knowledge, you might need more time or less time. You should already have a good understanding of Linux administration and system programming, and broad experience of using a programming language such as C or C++ and a scripting language such as PHP. If you are not familiar with terms such as system call, type, cast, signal, struct, or pointer, you might find difficulty in understanding some of the examples or completing some of the exercises. However, each exercise provides a sample solution in case you do get stuck. You are encouraged to experiment with the examples to develop your skills at creating DTrace programs.

Caution

To run the examples and perform the exercises in this tutorial, you need to have root access to a system. Only the root user or a user with sudo access to run commands as root can use the dtrace utility. As root, you have total power over a system and so have total responsibility for that system. Although DTrace is designed so that you can use it safely without needing to worry about corrupting the operating system or other processes, there are ways to circumvent the built-in safety measures.

Perform the examples and exercises in this tutorial on a system other than a production system.

The examples demonstrate the different ways that you can perform dynamic tracing of your system: by entering a simple D program as an argument to dtrace on the command line, by using dtrace to run a script that contains a D program, or by using an executable D script that contains a hashbang (#! or shebang) invocation of dtrace. When you create your own D programs, you can choose which method best suits your needs.