DTRACY(1)DTRACY(1)
NAME
dtracy – dynamic tracing language
SYNOPSIS
DESCRIPTION
probes { actions }
probes if predicate { actions }
Probes is a comma-separated list of probes, such as sys:pwrite:entry. Each probe name consists of any number of parts separated by :. If a part is omitted (e.g. qsys::entry), it matches all probes that match the remaining parts. If the probe name is enclosed in quotation marks, the wildcards * and ? are available, e.g. "sys:*stat:entry".
Predicate, if specified, is an expression that must evaluate to a non-zero value for the actions to be executed.
Actions is a semicolon-separated list of statements of one of the following forms:
expr
print a, b, ...
printf "fmt", a, b, ...
@name[index] = aggregation-expr
Expressions follow C syntax and semantics and all C operators (including casts) are supported.
Available integer types are
Expressions can use the following variables
name of the probe that was triggered
PID of the process triggering the probe
for a syscall probe, the syscall arguments (cast to s64)
timestamp when the probe was triggered
CPU number on which the probe was triggered
Statements of the form @name[index] = aggregation-expr collect statistics using a data structure referred to as an aggregation.
Each time the statement is evaluated adds another datapoint to the aggregation, which will be printed in tabular form when
Aggregation-expr specifies the type of statistic to be collected. Available options are
number of datapoints
average
sum
minimum
maximum
average and standard deviation
EXAMPLES
sys:: { print probe, pid, arg0, arg1 }
The world’s worst syscall tracer.
sys:pread:entry if pid == 42 { printf "time %d, fd %d\\n", time, arg0 }
Every time the process with PID 42 executes
sys:open:entry { print (string)arg0 }
Print the names of files as they are being opened.
sys:pread:entry { @size[pid] = avg(arg2) }
Determine the average
SOURCE
BUGS
Yes.