Returnstr; Thread_Indent - Red Hat ENTERPRISE LINUX 5.4 - SYSTEMTAP LANGUAGE Reference Manual

Systemtap language reference
Hide thumbs Also See for ENTERPRISE LINUX 5.4 - SYSTEMTAP LANGUAGE:
Table of Contents

Advertisement

Chapter 9. Predefined functions
errno_str:string (err:long)
This function returns the symbolic string associated with the given error code, such as ENOENT for
the number 2, or E#3333 for an out-of-range value such as 3333.

9.8.3. returnstr

General syntax:
returnstr:string (returnp:long)
This function is used by the syscall tapset, and returns a string. Set returnp equal to 1 for decimal, or 2
for hex.

9.8.4. thread_indent

General syntax:
thread_indent:string (delta:long)
This function returns a string with appropriate indentation for a thread. Call it with a small positive or
matching negative delta. If this is the outermost, initial level of indentation, then the function resets the
relative timestamp base to zero.
The following example uses thread_indent() to trace the functions called in the drivers/usb/core kernel
source. It prints a relative timestamp and the name and ID of the current process, followed by the
appropriate indent and the function name. Note that "swapper(0)" indicates the kernel is running in
interrupt context and there is no valid current process.
probe kernel.function("*@drivers/usb/core/*") {
printf ("%s -> %s\n", thread_indent(1), probefunc())
}
probe kernel.function("*@drivers/usb/core/*").return {
printf ("%s <- %s\n", thread_indent(-1), probefunc())
}
This prints:
0 swapper(0): -> usb_hcd_irq
8 swapper(0): <- usb_hcd_irq
0 swapper(0): -> usb_hcd_irq
10 swapper(0):
-> usb_hcd_giveback_urb
16 swapper(0):
22 swapper(0):
29 swapper(0):
35 swapper(0):
58
-> urb_unlink
<- urb_unlink
-> usb_free_urb
<- usb_free_urb

Advertisement

Table of Contents
loading

Table of Contents