Oracle Solaris 11 Administrator'S Cheat Sheet For Dtrace
Oracle Solaris 11 Administrator'S Cheat Sheet For Dtrace
Oracle Solaris 11 Administrator'S Cheat Sheet For Dtrace
sched
lockstat
Description
Start, end and error probes
Entry and return probes for all system calls
Entry and return probes for all kernel calls
Timer driven probes
Process creation and lifecycle probes
Entry and return probes for all user-level
processes
Probes for all I/O related events
Developer defined probes at arbitrary
locations/names within source code for kernel
and user-level processes
Probes for scheduling related events
Probes for locking behavior within the operating
system
D Scripting Language
As DTrace command line examples become more complex, it may be necessary to construct
them using the D scripting language an awk like script that can be run using the dtrace s
command. D scripts can consist of multiple clauses that usually specify one or more probe
descriptions, and their associate predicates and actions.
#!/usr/sbin/dtrace s
probe-description
/predicate/
{
action;
}
psinfo_t *curpsinfo
string execname
pid_t pid
string probefunc
string probemod
string probename
string probeprov
uint64_t timestamp
unint64_t vtimestamp
Description
The typed arguments to the current probe
accessed as args[0], args[1], but the type
corresponds to probe in question
The process state of the process associated with the
current thread, as described by proc(4)
The name that was passed to exec(2) to execute the
current process
The process ID of the current process
The function name portion of the current probes
description
The module name portion of the current probes
description
The name portion of the current probes description
The provider name portion of the current probes
description
The current value of a nanosecond timestamp
counter
The current value of a nanosecond timestamp
counter that is virtualized to the amount of time that
the current thread has been running on CPU, minus
time spent in predicates and actions
DTrace provides several built-in aggregating functions to aggregate data rather than rely
on individual data points. Aggregations can be expressed using the following:
@name[key] = aggfunc (args);
Common Aggregation
Functions
count
sum
avg
min
max
lquantize
quantize
clear
trunc
Description
Number of times that the count function is called
The total value of the specified expressions
The average of the specified expressions
The smallest value among the specified expressions
The largest value among the specified expressions
A linear frequency distribution of values of the specified
expression, sized by a specific range
A power-of-two frequency distribution of values of the
specified expression.
Clear values in an aggregation
Truncate aggregation data to certain values
Actions enable DTrace to interact with the system outside whether to record data or
perform destructive behavior (with required security privileges). Subroutines are used to
affect internal state such as string manipulation
Common Actions and
Subroutines
trace
printf
printa
stack
ustack
stop
copyinstr
strjoin
strlen
Description
Outputs the result of an expression to the buffer
Outputs the arguments to the buffer with a specified
format
Outputs the aggregation arguments to the buffer with a
specified format
Outputs kernel stack to the buffer
Outputs the user-level stack to the buffer
Stops the process that fired the probe (destructive)
Copies string from address referenced by pointer to the
buffer
Concatenates two strings
Returns length of a string
Contact Us
For more information about Oracle Solaris 11, visit oracle.com/solaris or call +1.800.ORACLE1 to speak to an Oracle representative. Last updated: April 11, 2013.