2.9.5 Built-In Variables

The following table provides a complete list of built-in D variables. All of these variables are scalar global variables.

Table 2.13 DTrace Built-In Variables

Variable

Description

args[]

The typed arguments, if any, to the current probe. The args[] array is accessed using an integer index, but each element is defined to be the type corresponding to the given probe argument. For information about any typed arguments, use dtrace -l with the verbose option -v and check Argument Types.

int64_t arg0, ..., arg9

The first ten input arguments to a probe, represented as raw 64-bit integers. Values are meaningful only for arguments defined for the current probe.

uintptr_t caller

The program counter location of the current kernel thread at the time the probe fired.

chipid_t chip

The CPU chip identifier for the current physical chip.

processorid_t cpu

The CPU identifier for the current CPU. See Section 11.8, “sched Provider” for more information.

cpuinfo_t *curcpu

The CPU information for the current CPU. See Section 11.8, “sched Provider”.

lwpsinfo_t *curlwpsinfo

The process state of the current thread. See Section 11.7, “proc Provider”.

psinfo_t *curpsinfo

The process state of the process associated with the current thread. See Section 11.7, “proc Provider”.

task_struct *curthread

Is a vmlinux data type, for which members can be found by searching for "task_struct" on the Internet.

string cwd

The name of the current working directory of the process associated with the current thread.

uint_t epid

The enabled probe ID (EPID) for the current probe. This integer uniquely identifies a particular probe that is enabled with a specific predicate and set of actions.

int errno

The error value returned by the last system call executed by this thread.

string execname

The name that was passed to execve() to execute the current process.

fileinfo_t fds[]

The files that the current process has opened in an fileinfo_t array, indexed by file descriptor number. See Section 11.9.2.3, “fileinfo_t”.

Note

You must load the sdt kernel module for fds[] to be available.

gid_t gid

The real group ID of the current process.

uint_t id

The probe ID for the current probe. This ID is the system-wide unique identifier for the probe, as published by DTrace and listed in the output of dtrace -l.

uint_t ipl

The interrupt priority level (IPL) on the current CPU at probe firing time.

Note

This value is non-zero if interrupts are firing and zero otherwise. The non-zero value depends on whether preemption is active, as well as other factors, and can vary between kernel releases and kernel configurations.

lgrp_id_t lgrp

The latency group ID for the latency group of which the current CPU is a member. This value is always zero.

pid_t pid

The process ID of the current process.

pid_t ppid

The parent process ID of the current process.

string probefunc

The function name portion of the current probe's description.

string probemod

The module name portion of the current probe's description.

string probename

The name portion of the current probe's description.

string probeprov

The provider name portion of the current probe's description.

psetid_t pset

The processor set ID for the processor set containing the current CPU. This value is always zero.

string root

The name of the root directory of the process that is associated with the current thread.

uint_t stackdepth

The current thread's stack frame depth at probe firing time.

id_t tid

The task ID of the current thread.

uint64_t timestamp

The current value of a nanosecond timestamp counter. This counter increments from an arbitrary point in the past and should only be used for relative computations.

uintptr_t ucaller

The program counter location of the current user thread at the time the probe fired.

uid_t uid

The real user ID of the current process.

uint64_t uregs[]

The current thread's saved user-mode register values at probe firing time. Use of the uregs[] array is discussed in Section 12.5, “uregs[] Array”.

uint64_t vtimestamp

The current value of a nanosecond timestamp counter that is virtualized to the amount of time that the current thread has been running on a CPU, minus the time spent in DTrace predicates and actions. This counter increments from an arbitrary point in the past and should only be used for relative time computations.

int64_t walltimestamp

The current number of nanoseconds since 00:00 Universal Coordinated Time, January 1, 1970.


Functions that are built into the D language such as trace are discussed in Chapter 4, Actions and Subroutines.