3 .\" The contents of this file are subject to the terms of the
4 .\" Common Development and Distribution License (the "License").
5 .\" You may not use this file except in compliance with the License.
7 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8 .\" or http://www.opensolaris.org/os/licensing.
9 .\" See the License for the specific language governing permissions
10 .\" and limitations under the License.
12 .\" When distributing Covered Code, include this CDDL HEADER in each
13 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14 .\" If applicable, add the following below this CDDL HEADER, with the
15 .\" fields enclosed by brackets "[]" replaced with your own identifying
16 .\" information: Portions Copyright [yyyy] [name of copyright owner]
19 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
28 .Nd dynamic tracing compiler and tracing utility
32 .Op Fl aACeFGhHlqSvVwZ
35 .Op Fl D Ar name Op Ns = Ns value
41 .Op Fl x Ar arg Op Ns = Ns value
42 .Op Fl X Cm a | c | s | t
44 .Op Fl P Ar provider Oo Oo Ar predicate Oc Ar action Oc
45 .Op Fl m Oo Ar provider : Oc Ar module Oo Oo Ar predicate Oc Ar action Oc
46 .Op Fl f Oo Oo Ar provider : Oc Ar module : Oc Ar function Oo Oo Ar predicate \
48 .Op Fl n Oo Oo Oo Ar provider : Oc Ar module : Oc Ar function : Oc Ar name \
49 Oo Oo Ar predicate Oc Ar action Oc
50 .Op Fl i Ar probe-id Oo Oo Ar predicate Oc Ar action Oc
52 DTrace is a comprehensive dynamic tracing framework ported from Solaris.
53 DTrace provides a powerful infrastructure that permits administrators,
54 developers, and service personnel to concisely answer arbitrary questions about
55 the behavior of the operating system and user programs.
59 command provides a generic interface to the essential services provided by the
60 DTrace facility, including:
61 .Bl -bullet -offset indent
63 Options that list the set of probes and providers currently published by DTrace
65 Options that enable probes directly using any of the probe description
66 specifiers (provider, module, function, name)
68 Options that run the D compiler and compile one or more D program files or
69 programs written directly on the command line
71 Options that generate anonymous tracing programs
73 Options that generate program stability reports
75 Options that modify DTrace tracing and buffering behavior and enable
76 additional D compiler features
81 to create D scripts by using it in a shebang declaration to create an
85 to attempt to compile D programs and determine their properties without
86 actually enabling traces using the
90 The arguments accepted by the
97 options can include an optional D language
99 enclosed in slashes and an optional D language
101 statement list enclosed in braces.
102 D program code specified on the command line must be appropriately quoted to
103 avoid interpretation of meta-characters by the shell.
105 The following options are supported:
106 .Bl -tag -width indent
108 The D compiler produces programs using the native data model of the operating
114 forces the D compiler to compile a D program using the 32-bit data model.
119 forces the D compiler to compile a D program using the 64-bit data model.
120 These options are typically not required as
122 selects the native data model as the default.
123 The data model affects the sizes of integer types and other language properties.
124 D programs compiled for either data model can be executed on both 32-bit and
130 options also determine the
132 file format (ELF32 or ELF64) produced by the
136 Claim anonymous tracing state and display the traced data.
143 to exit immediately after consuming the anonymous tracing state rather than
144 continuing to wait for new data.
146 Generate directives for anonymous tracing and write them to
147 .Pa /boot/dtrace.dof .
148 This option constructs a set of dtrace configuration file directives to enable
149 the specified probes for anonymous tracing and then exits.
152 attempts to store the directives to the file
153 .Pa /boot/dtrace.dof .
154 This behavior can be modified using the
156 option to specify an alternate output file.
158 Set the principal trace buffer size to
160 The trace buffer size can include any of the size suffixes k, m, g, or t.
161 If the buffer space cannot be allocated,
163 attempts to reduce the buffer size or exit depending on the setting of the
166 Run the specified command
168 and exit upon its completion.
171 option is present on the command line,
173 exits when all commands have exited, reporting the exit status for each child
174 process as it terminates.
175 The process ID of the first command is made available to any D programs
176 specified on the command line or using the
182 Run the C preprocessor
184 over D programs before compiling them.
185 You can pass options to the C preprocessor using the
192 You can select the degree of C standard conformance if you use the
195 For a description of the set of tokens defined by the D compiler when invoking
196 the C preprocessor, see
198 .It Fl D Ar name Op Ns = Ns value
206 If you specify an additional
208 the name is assigned the corresponding value.
209 This option passes the
215 Exit after compiling any requests and consuming anonymous tracing state
217 option) but prior to enabling any probes.
218 You can combine this option with the
220 option to print anonymous tracing data and exit.
221 You can also combine this option with D compiler options.
222 This combination verifies that the programs compile without actually executing
223 them and enabling the corresponding instrumentation.
224 .It Fl f Oo Oo Ar provider : Oc Ar module : Oc Ar function Oo Oo Ar predicate \
226 Specify function name to trace or list
229 The corresponding argument can include any of the probe description forms
230 .Ar provider:module:function ,
231 .Ar module:function ,
234 Unspecified probe description fields are left blank and match any probes
235 regardless of the values in those fields.
236 If no qualifiers other than
238 are specified in the description, all probes with the corresponding
243 argument can be suffixed with an optional D probe clause.
244 You can specify more than one
246 option on the command line at a time.
248 Coalesce trace output by identifying function entry and return.
249 Function entry probe reports are indented and their output is prefixed with
251 Function return probe reports are unindented and their output is prefixed with
253 System call entry probe reports are indented and their output is prefixed with
255 System call return probe reports are unindented and their output is prefixed
259 Generate an ELF file containing an embedded DTrace program.
260 The DTrace probes specified in the program are saved inside of a relocatable ELF
261 object which can be linked into another program.
264 option is present, the ELF file is saved using the pathname specified as the
265 argument for this operand.
268 option is not present and the DTrace program is contained with a file whose name
271 then the ELF file is saved using the name
273 Otherwise the ELF file is saved using the name d.out.
275 Generate a header file containing macros that correspond to probes in the
276 specified provider definitions.
277 This option should be used to generate a header file that is included by other
278 source files for later use with the
283 option is present, the header file is saved using the pathname specified as the
284 argument for that option.
287 option is not present and the DTrace program is contained within a file whose
290 then the header file is saved using the name
293 Print the pathnames of included files when invoking
298 This option passes the
302 invocation, causing it to display the list of pathnames, one for each line, to
304 .It Fl i Ar probe-id Op Oo Ar predicate Oc Ar action
305 Specify probe identifier
310 You can specify probe IDs using decimal integers as shown by `dtrace -l`.
313 argument can be suffixed with an optional D probe clause.
314 You can specify more than one
318 Add the specified directory
320 to the search path for #include files when invoking
325 This option passes the
332 is inserted into the search path ahead of the default directory list.
334 List probes instead of enabling them.
339 produces a report of the probes matching the descriptions given using the
340 .Fl P , m , f , n , i ,
344 If none of these options are specified, this option lists all probes.
346 Add the specified directory
348 to the search path for DTrace libraries.
349 DTrace libraries are used to contain common definitions that can be used when
353 is added after the default library search path.
354 .It Fl m Oo Ar provider : Oc Ar module Oo Oo Ar predicate Oc Ar action Oc
355 Specify module name to trace or list
358 The corresponding argument can include any of the probe description forms
362 Unspecified probe description fields are left blank and match any probes
363 regardless of the values in those fields.
364 If no qualifiers other than
366 are specified in the description, all probes with a corresponding
371 argument can be suffixed with an optional D probe clause.
374 option can be specified on the command line at a time.
375 .It Fl n Oo Oo Oo Ar provider : Oc Ar module : Oc Ar function : Oc Ar name \
376 Oo Oo Ar predicate Oc Ar action Oc
377 Specify probe name to trace or list
380 The corresponding argument can include any of the probe description forms
381 .Ar provider:module:function:name , module:function:name , function:name ,
384 Unspecified probe description fields are left blank and match any probes
385 regardless of the values in those fields.
386 If no qualifiers other than
388 are specified in the description, all probes with a corresponding
393 argument can be suffixed with an optional D probe clause.
396 option can be specified on the command line at a time.
404 options, or for the traced data itself.
407 option is present and
409 is not present, the default output file is
410 .Pa /boot/dtrace.dof .
413 option is present and the
415 option's argument is of the form
419 is not present, the default output file is
421 Otherwise the default output file is
424 Grab the specified process-ID
426 cache its symbol tables, and exit upon its completion.
429 option is present on the command line,
431 exits when all commands have exited, reporting the exit status for each process
433 The first process-ID is made available to any D programs specified on the
434 command line or using the
439 .It Fl P Ar provider Oo Oo Ar predicate Oc Ar action Oc
440 Specify provider name to trace or list
443 The remaining probe description fields module, function, and name are left
444 blank and match any probes regardless of the values in those fields.
447 argument can be suffixed with an optional D probe clause.
448 You can specify more than one
450 option on the command line at a time.
454 suppresses messages such as the number of probes matched by the specified
455 options and D programs and does not print column headers, the CPU ID, the probe
456 ID, or insert newlines into the output.
457 Only data traced and formatted by D program statements such as
461 is displayed to standard output.
463 Compile the specified D program source file.
466 option is present, the program is compiled but instrumentation is not enabled.
469 option is present, the program is compiled and the set of probes matched by it
470 is listed, but instrumentation is not enabled.
475 are present, the instrumentation specified by the D program is enabled and
478 Show D compiler intermediate code.
479 The D compiler produces a report of the intermediate code generated for each D
480 program to standard error.
482 Undefine the specified
489 This option passes the
500 produces a program stability report showing the minimum interface stability and
501 dependency level for the specified D programs.
503 Report the highest D programming interface version supported by
505 The version information is printed to standard output and the
509 Permit destructive actions in D programs specified using the
510 .Fl s , P , m , f , n ,
516 option is not specified,
518 does not permit the compilation or enabling of a D program that contains
520 .It Fl x Ar arg Op Ns = Ns value
521 Enable or modify a DTrace runtime option or D compiler option.
522 Boolean options are enabled by specifying their name.
523 Options with values are set by separating the option name and value with an
528 argument may be suffixed with one of
534 (either upper or lower case) to indicate a multiple of
535 Kilobytes, Megabytes, Gigabytes or Terabytes
540 argument may be suffixed with one of
556 If no suffix is specified
558 will be used as the unit.
559 .Bl -tag -width indent
560 .It Sy aggrate Ns = Ns Ar time
561 Rate of aggregation reading.
562 .It Sy aggsize Ns = Ns Ar size
563 Size of the aggregation buffer.
564 .It Sy bufpolicy Ns = Ns Cm fill Ns | Ns Cm switch Ns | Ns Cm ring
565 Specifies the buffer policy for the principal buffer.
566 .It Sy bufresize Ns = Ns Cm auto Ns | Ns Cm manual
567 Buffer resizing policy.
568 .It Sy bufsize Ns = Ns Ar size
569 Size of the per-CPU principal buffer.
573 .It Sy cleanrate Ns = Ns Ar time
575 Must be specified in number-per-second with the
578 .It Sy cpu Ns = Ns Ar scalar
579 Specifies the CPU on which to enable tracing.
581 Allow references to unspecified macro arguments.
583 Allow destructive actions.
587 .It Sy dynvarsize Ns = Ns Ar size
588 Size of the dynamic variable space.
590 Turn on flow indentation.
595 Claim anonymous state.
599 .It Sy jstackframes Ns = Ns Ar scalar
600 Number of default stack frames for
602 .It Sy jstackstrsize Ns = Ns Ar scalar
603 Default string space size for
605 .It Sy nspec Ns = Ns Ar scalar
606 Number of speculations.
612 .It Sy specsize Ns = Ns Ar size
613 Size of the speculation buffer.
614 .It Sy strsize Ns = Ns Ar size
615 Maximum size of strings.
616 .It Sy stackframes Ns = Ns Ar scalar
617 Maximum number of kernelspace stack frames to unwind when executing the
620 .It Sy stackindent Ns = Ns Ar scalar
621 Number of whitespace characters to use when indenting
626 .It Sy statusrate Ns = Ns Ar time
627 Rate of status checking.
628 .It Sy switchrate Ns = Ns Ar time
629 Rate of buffer switching.
630 .It Sy ustackframes Ns = Ns Ar scalar
631 Maximum number of userspace stack frames to unwind when executing the
635 .It Fl X Cm a | c | s | t
636 Specify the degree of conformance to the ISO C standard that should be selected
644 option argument affects the value and presence of the __STDC__ macro depending
645 upon the value of the argument letter.
649 option supports the following arguments:
650 .Bl -tag -width indent
653 ISO C plus K&R compatibility extensions, with semantic changes required by ISO
655 This is the default mode if
658 The predefined macro __STDC__ has a value of 0 when
660 is invoked in conjunction with the
665 Strictly conformant ISO C, without K&R C compatibility extensions.
666 The predefined macro __STDC__ has a value of 1 when
668 is invoked in conjunction with the
673 The macro __STDC__ is not defined when
675 is invoked in conjunction with the
680 ISO C plus K&R C compatibility extensions, without semantic changes required by
682 The predefined macro __STDC__ has a value of 0 when
684 is invoked in conjunction with the
691 option only affects how the D compiler invokes the C preprocessor, the
695 options are equivalent from the perspective of D and both are provided only to
696 ease re-use of settings from a C build environment.
700 mode, the following additional C preprocessor definitions are always specified
701 and valid in all modes:
702 .Bl -bullet -offset indent
710 __sparc (on SPARC systems only)
712 __sparcv9 (on SPARC systems only when 64-bit programs are compiled)
714 __i386 (on x86 systems only when 32-bit programs are compiled)
716 __amd64 (on x86 systems only when 64-bit programs are compiled)
718 __`uname -s`_`uname -r` (for example,
719 .Ql FreeBSD_9.2-RELEASE .
723 .No __SUNW_D_VERSION=0x Ns Ar MMmmmuuu
727 is the major release value in hexadecimal,
729 is the minor release value in hexadecimal, and
731 is the micro release value in hexadecimal.
734 Permit probe descriptions that match zero probes.
737 option is not specified,
739 reports an error and exits if any probe descriptions specified in D program
742 option) or on the command line
743 .Fl ( P , m , f , n ,
746 options) contain descriptions that do not match any known probes.
749 You can specify zero or more additional arguments on the
751 command line to define a set of macro variables and so forth).
752 The additional arguments can be used in D programs specified using the
754 option or on the command line.
756 .Bl -tag -width /boot/dtrace.dof -compact
757 .It Pa /boot/dtrace.dof
758 File for anonymous tracing directives.
761 The following exit statuses are returned:
762 .Bl -tag -width indent
764 Successful completion.
766 For D program requests, an exit status of 0 indicates that programs were
767 successfully compiled, probes were successfully enabled, or anonymous state
768 was successfully retrieved.
770 returns 0 even if the specified tracing requests encountered errors or drops.
774 For D program requests, an exit status of 1 indicates that program compilation
775 failed or that the specified request could not be satisfied.
777 Invalid command line options or arguments were specified.
784 .%T Solaris Dynamic Tracing Guide