File: dtrace.1

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (141 lines) | stat: -rw-r--r-- 3,412 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
.\" -*- nroff -*-
.TH DTRACE 1 
.SH NAME
dtrace \- Dtrace compatible user application static probe generation tool.

.\" macros
.\" do not nest SAMPLEs
.de SAMPLE
.br

.nr oldin \\n(.i
.RS
.nf
.nh
..
.de ESAMPLE
.hy
.fi
.RE
.in \\n[oldin]u

..

.SH SYNOPSIS

.br
.B dtrace \-s \fIfile\fR [\fBOPTIONS\fR]

.SH DESCRIPTION

The dtrace command converts probe descriptions defined in \fIfile.d\fR
into a probe header
file via the \fB\-h\fR option
or a probe description file via the \fB\-G\fR option.

.SH OPTIONS
.PP
.TP
.B \-h
generate a systemtap header file.

.TP
.B \-G
generate a systemtap probe definition object file.  This invokes the C
compiler with a sensible set of compiler flags.  If you need to add
more, flags found in the \fBCFLAGS\fP environment variable will be
transcribed to the compiler.  If this is not enough control, use the
\-k option to capture the generated C file and compile as needed.

.TP
.B \-o \fIfile\fR
is the name of the output file.  If the \fB\-G\fR option is given then
the output file will be called \fIfile.o\fR; if the \fB\-h\fR option is
given then the output file will be called \fIfile.h\fR.

.TP
.B \-C
run the cpp preprocessor on the input file when the \fB\-h\fR option
is given.

.TP
.B \-I \fIfile\fR
give this include path to cpp when the \fB\-C\fR option is given.

.TP
.B \-k
keep temporary files, for example the C language source for the
\fB\-G\fR option.

.SH EXAMPLES

Systemtap is source compatible with dtrace user application static
probe support.
Given a file \fItest.d\fR containing:
.SAMPLE
provider sdt_probes 
{
  probe test_0 (int type);
  probe test_1 (struct astruct node);
};
struct astruct {int a; int b;};
.ESAMPLE
Then the command \fI"dtrace\ \-s\ test.d\ \-G"\fR will create the
probe definition file \fItest.o\fR and the command \fI"dtrace\ \-s\
test.d\ \-h"\fR will create the probe header file \fItest.h\fR
Subsequently the application can use the generated macros this way:
.SAMPLE
#include "test.h"
 \.\.\.
struct astruct s;
 \.\.\.
SDT_PROBES_TEST_0(value);
 \.\.\.
if (SDT_PROBES_TEST_1_ENABLED())
    SDT_PROBES_TEST_1(expensive_function(s));
.ESAMPLE

.SH SEMAPHORES

Semaphores are flag variables used by probes as a way of bypassing
potentially costly processing to prepare arguments for probes that may
not even be active.  They are automatically set/cleared by systemtap
when a relevant script is running, so the argument setup cost is only
paid when necessary.  These semaphore variables are defined within the
the \fI"test.o"\fR object file, which must therefore be linked into an
application.
.PP
Sometimes, semaphore variables are not necessary nor helpful.  Skipping
them can simplify the build process, by omitting the extra \fI"test.o"\fR
file.  To skip dependence upon semaphore variables, include \fI"<sys/sdt.h>"\fR
within the application before \fI"test.h"\fR:
.SAMPLE
#include <sys/sdt.h>
#include "test.h"
 \.\.\.
struct astruct s;
 \.\.\.
SDT_PROBES_TEST_0(value);
 \.\.\.
if (SDT_PROBES_TEST_1_ENABLED())
   SDT_PROBES_TEST_1(cheap_function(s));
.ESAMPLE
In this mode, the ENABLED() test is fixed at 1.

.SH SEE ALSO
.nh
.nf
.IR stap (1),
.IR stappaths (7)


.SH BUGS
Use the Bugzilla link of the project web page or our mailing list.
.nh
.BR http://sourceware.org/systemtap/ ", " <systemtap@sourceware.org> .
.hy
.PP
.IR error::reporting (7stap),
.nh
.BR https://sourceware.org/systemtap/wiki/HowToReportBugs
.hy