]> sourceware.org Git - systemtap.git/blame - stapfuncs.3stap
Add user_{int8,int16,uint16,int32,uint32,int64}.
[systemtap.git] / stapfuncs.3stap
CommitLineData
ba4a90fd 1.\" -*- nroff -*-
ec1a2239 2.TH STAPFUNCS 3stap
ba4a90fd
FCE
3.SH NAME
4stapfuncs \- systemtap functions
5
6.SH DESCRIPTION
89965a32 7The following sections enumerate a few of public functions provided by
ec1a2239 8standard tapsets installed, show in the stappaths (7) manual page. Most
89965a32
FCE
9are individually documented in the
10.IR 3stap
11manual section, with the
12.IR function::
13prefix.
14.PP
15Each function is described with a signature, and its behavior/restrictions.
ba4a90fd
FCE
16The signature line includes the name of the function, the type of
17its return value (if any), and the names and types of all parameters.
18The syntax is the same as printed with the
13d2ecdb 19.IR stap " option " \-p2 .
ba4a90fd
FCE
20Examples:
21
22.TP
23example1:long (v:string, k:long)
cc9ee605
FCE
24In function "example1", do something with the given string and integer.
25Return some integer.
ba4a90fd
FCE
26
27.TP
28example2:unknown ()
cc9ee605
FCE
29In function "example2", do something. There is no explicit return value
30and take no parameters.
ba4a90fd 31
ba4a90fd 32
1902aec1
FCE
33.SS TARGET_SET
34.TP
35target_set_pid:long (tid:long)
36Return whether the given process-id is within the "target set", that is whether
37it is a descendent of the top-level target() process.
38.TP
39target_set_report:unknown ()
40Print a report about the target set, and their ancestry.
41
ab4ff75b 42.SS ERRNO
48ce39e1
KS
43.TP
44errno_str:string (e:long)
ab4ff75b
FCE
45Return the symbolic string associated with the given error code, like
46"ENOENT" for the number 2, or "E#3333" for an out-of-range value like 3333.
48ce39e1 47
89965a32 48.SS REGISTERS
af26b140 49.TP
ff0c3d4c
JK
50register:long (name:string)
51Return the value of the named CPU register,
52as it was saved when the current probe point was hit.
53If the register is 32 bits, it is sign-extended to 64 bits.
54
55For the i386 architecture, the following names are recognized.
56(name1/name2 indicates that name1 and name2 are alternative names
57for the same register.)
58eax/ax, ebp/bp, ebx/bx, ecx/cx, edi/di, edx/dx, eflags/flags,
59eip/ip, esi/si, esp/sp, orig_eax/orig_ax,
60xcs/cs, xds/ds, xes/es, xfs/fs, xss/ss.
61
62For the x86_64 architecture, the following names are recognized:
6364-bit registers:
64r8, r9, r10, r11, r12, r13, r14, r15,
65rax/ax, rbp/bp, rbx/bx, rcx/cx, rdi/di, rdx/dx,
66rip/ip, rsi/si, rsp/sp;
6732-bit registers:
68eax, ebp, ebx, ecx, edx, edi, edx, eip, esi, esp, flags/eflags, orig_eax;
69segment registers: xcs/cs, xss/ss.
dbb280c7
AM
70
71For powerpc, the following names are recognized:
50a0afbe 72r0, r1, ... r31, nip, msr, orig_gpr3, ctr, link, xer, ccr, softe, trap,
af26b140 73dar, dsisr, result.
dbb280c7 74
50a0afbe
JK
75For s390x, the following names are recognized:
76r0, r1, ... r15, args, psw.mask, psw.addr, orig_gpr2, ilc, trap.
77
ff0c3d4c
JK
78.TP
79u_register:long (name:string)
80Same as register(name), except that
81if the register is 32 bits, it is zero-extended to 64 bits.
82
83.SS NUMBERED FUNCTION ARGUMENTS
84The functions in this section provide the values of a probed function's
85arguments.
86They can be called when you have hit
87a probe point at the entry to a function.
88Arguments are referred to by number, starting at 1.
89Ordinarily, you can access arguments by name as well,
90but you may find these functions useful if the code you are probing
91was built without debugging information.
92
93On 32-bit architectures
94\(em and when probing 32-bit applications on 64-bit architectures \(em
95a 64-bit argument occupies two "arg slots."
96For example, if you are probing the following function
97
98 void f(int a, long long b, char *c)
99
100you would refer to a, b, and c as int_arg(1), longlong_arg(2), and
101pointer_arg(3), respectively, on a 64-bit architecture;
102but on a 32-bit architecture, you would refer to c as pointer_arg(4)
103(since b occupies slots 2 and 3).
104
105If the function you are probing doesn't follow the default rules
106for argument passing, you need to call one of the following functions
107(which see) in your handler before calling any *_arg function:
108asmlinkage(), fastcall(), or regparm().
109(This isn't necessary when referring to arguments only by name.)
110.TP
111int_arg:long (n:long)
112Return the value of argument n as a signed int
113(i.e., a 32-bit integer sign-extended to 64 bits).
114.TP
115uint_arg:long (n:long)
116Return the value of argument n as an unsigned int
117(i.e., a 32-bit integer zero-extended to 64 bits).
118.TP
119long_arg:long (n:long)
120Return the value of argument n as a signed long.
121On architectures where a long is 32 bits, the value is sign-extended to 64 bits.
122.TP
123ulong_arg:long (n:long)
124Return the value of argument n as an unsigned long.
125On architectures where a long is 32 bits, the value is zero-extended to 64 bits.
126.TP
127longlong_arg:long (n:long)
128Return the value of argument n as a 64-bit value.
129.TP
130ulonglong_arg:long (n:long)
131Same as longlong_arg(n).
132.TP
133pointer_arg:long (n:long)
134Same as ulong_arg(n).
135Use with any type of pointer.
136.TP
137s32_arg:long (n:long)
138Same as int_arg(n).
139.TP
140u32_arg:long (n:long)
141Same as uint_arg(n).
142.TP
143s64_arg:long (n:long)
144Same as longlong_arg(n).
145.TP
146u64_arg:long (n:long)
147Same as [u]longlong_arg(n).
148.TP
149asmlinkage:unknown ()
150The probed kernel function is declared asmlinkage in the source.
151.TP
152fastcall:unknown ()
153The probed kernel function is declared fastcall in the source.
154.TP
155regparm:unknown (n:long)
156The probed function was built with the gcc \-mregparm=n option.
157(The i386 kernel is built with \-mregparm=3, so systemtap considers
158regparm(3) the default for kernel functions on that architecture.)
159
50a0afbe 160For some architectures, the *_arg functions may reject unusually high
dbb280c7
AM
161values of n.
162
2a99f48f
FCE
163.SS QUEUE_STATS
164.PP
165The queue_stats tapset provides functions that, given notifications of
166elementary queuing events (wait, run, done), tracks averages such as
5db55886 167queue length, service and wait times, utilization. The following
2a99f48f
FCE
168three functions should be called from appropriate probes, in sequence.
169.TP
170qs_wait:unknown (qname:string)
171Record that a new request was enqueued for the given queue name.
172.TP
173qs_run:unknown (qname:string)
174Record that a previously enqueued request was removed from the given
175wait queue and is now being serviced.
176.TP
177qs_done:unknown (qname:string)
178Record that a request originally from the given queue has completed
179being serviced.
180.\" XXX: qs_time
181.PP
182Functions with the prefix
183.BR qsq_
184are for querying the statistics averaged since the first queue operation
185(or when
186.BR qsq_start
187was called). Since statistics are often fractional, a scale parameter
188is multiplies the result to a more useful scale. For some fractions,
189a scale of 100 will usefully return percentage numbers.
190.TP
191qsq_start:unknown (qname:string)
192Reset the statistics counters for the given queue, and start tracking
193anew from this moment.
194.TP
195qsq_print:unknown (qname:string)
196Print a line containing a selection of the given queue's statistics.
197.TP
198qsq_utilization:long (qname:string, scale:long)
199Return the fraction of elapsed time when the resource was utilized.
200.TP
201qsq_blocked:long (qname:string, scale:long)
202Return the fraction of elapsed time when the wait queue was used.
203.TP
204qsq_wait_queue_length:long (qname:string, scale:long)
205Return the average length of the wait queue.
206.TP
207qsq_service_time:long (qname:string, scale:long)
208Return the average time required to service a request.
209.TP
210qsq_wait_time:long (qname:string, scale:long)
211Return the average time a request took from being enqueued to completed.
212.TP
213qsq_throughput:long (qname:string, scale:long)
214Return the average rate of requests per scale units of time.
21c0e74e 215
4090de8c
FCE
216.SS INDENT
217.PP
218The indent tapset provides functions to generate indented lines for
219nested kinds of trace messages. Each line contains a relative
220timestamp, and the process name / pid.
221.TP
222thread_indent:string (delta:long)
223Return a string with an appropriate indentation for this thread.
224Call it with a small positive or matching negative delta.
225If this is the outermost, initial level of indentation, reset the
226relative timestamp base to zero.
227.TP
228thread_timestamp:long ()
229Return an absolute timestamp value for use by the indentation function.
230The default function uses
231.IR gettimeofday_us
232
70404fc5
MH
233.SS SYSTEM
234.TP
235system (cmd:string)
236Runs a command on the system. The command will run in the background
237when the current probe completes.
238
3797855d 239
bfb72442
FCE
240.SS INET
241These functions convert between network (big-endian) and host byte order, like their
242namesake C functions.
243.TP
244ntohll:long (x:long)
245Convert from network to host byte order, 64-bit.
246.TP
247ntohl:long (x:long)
248Convert from network to host byte order, 32-bit.
249.TP
250ntohs:long (x:long)
251Convert from network to host byte order, 16-bit.
252.TP
253htonll:long (x:long)
254Convert from host to network byte order, 64-bit.
255.TP
256htonl:long (x:long)
257Convert from host to network byte order, 32-bit.
258.TP
259htons:long (x:long)
260Convert from host to network byte order, 16-bit.
261
ed22941d
ET
262.SS SIGNAL
263.TP
264get_sa_flags:long (act:long)
265Returns the numeric value of sa_flags.
266.TP
267get_sa_handler:long (act:long)
268Returns the numeric value of sa_handler.
269.TP
270sigset_mask_str:string (mask:long)
271Returns the string representation of the sigset sa_mask.
272.TP
273is_sig_blocked:long (task:long, sig:long)
274Returns 1 if the signal is currently blocked, or 0 if it is not.
275.TP
276sa_flags_str:string (sa_flags:long)
277Returns the string representation of sa_flags.
278.TP
279sa_handler_str(handler)
280Returns the string representation of sa_handler. If it is not SIG_DFL, SIG_IGN
281or SIG_ERR, it will return the address of the handler.
282.TP
283signal_str(num)
284Returns the string representation of the given signal number.
bfb72442 285
e3cbdeff
WC
286.SS DEVICE
287.TP
288MAJOR:long(dev:long)
289Extracts the major device number from a kernel device number (kdev_t).
290.TP
291MINOR:long(dev:long)
292Extracts the minor device number from a kernel device number (kdev_t).
293.TP
294MKDEV:long(major:long, minor:long)
295Creates a value that can be compared to a kernel device number (kdev_t).
296.TP
297usrdev2kerndev:long(dev:long)
298Converts a user-space device number into the format used in the kernel.
299
ba4a90fd 300.SH FILES
ec1a2239
LB
301.TP
302More files and their corresponding paths can be found in the stappaths (7) manual page.
ba4a90fd
FCE
303
304.SH SEE ALSO
89965a32
FCE
305.IR stap (1),
306.IR function::* (3stap),
ec1a2239
LB
307.IR tapset::* (3stap),
308.IR stappaths (7)
This page took 0.114722 seconds and 5 git commands to generate.