Skip Navigation Links | |
Exit Print View | |
Oracle Solaris 11.1 Dynamic Tracing Guide Oracle Solaris 11.1 Information Library |
Probe Clauses and Declarations
Compilation and Instrumentation
Variables and Arithmetic Expressions
Types, Operators, and Expressions
Increment and Decrement Operators
Array Declarations and Storage
Pointer and Array Relationship
13. Statically Defined Tracing for User Applications
DTrace instrumentation executes inside the Oracle Solaris operating system kernel, so in addition to accessing special DTrace variables and probe arguments, you can also access kernel data structures, symbols, and types. These capabilities enable advanced DTrace users, administrators, service personnel, and driver developers to examine low-level behavior of the operating system kernel and device drivers. The reading list at the start of this book includes books that can help you learn more about Oracle Solaris operating system internals.
D uses the backquote character (`) as a special scoping operator for accessing symbols that are defined in the operating system and not in your D program. For example, the Oracle Solaris kernel contains a C declaration of a system tunable named kmem_flags for enabling memory allocator debugging features. See Oracle Solaris 11.1 Tunable Parameters Reference Manual for more information about kmem_flags. This tunable is declared in C in the kernel source code as follows:
int kmem_flags;
To trace the value of this variable in a D program, you can write the D statement:
trace(`kmem_flags);
DTrace associates each kernel symbol with the type used for it in the corresponding operating system C code, providing easy source-based access to the native operating system data structures. Kernel symbol names are kept in a separate namespace from D variable and function identifiers, so you never need to worry about these names conflicting with your D variables.
You have now completed a whirlwind tour of DTrace and you've learned many of the basic DTrace building blocks necessary to build larger and more complex D programs. The following chapters describe the complete set of rules for D and demonstrate how DTrace can make complex performance measurements and functional analysis of the system easy. Later, you'll see how to use DTrace to connect user application behavior to system behavior, giving you the capability to analyze your entire software stack.