Chapter 3. Understanding How SystemTap Works
probe syscall.open
{
printf ("%s(%d) open\n", execname(), pid())
}
Example 3.5. variables-in-printf-statements.stp
Example 3.5, "variables-in-printf-statements.stp"
call open; for each event, it prints the current execname() (a string with the executable name) and
pid() (the current process ID number), followed by the word open. A snippet of this probe's output
would look like:
vmware-guestd(2206) open
hald(2360) open
hald(2360) open
hald(2360) open
df(3433) open
df(3433) open
df(3433) open
hald(2360) open
SystemTap Functions
SystemTap supports a wide variety of functions that can be used as printf () arguments.
Example 3.5, "variables-in-printf-statements.stp"
of the process that called a kernel function/performed a system call) and pid() (current process ID).
The following is a list of commonly-used SystemTap functions:
tid()
The ID of the current thread.
uid()
The ID of the current user.
cpu()
The current CPU number.
gettimeofday_s()
The number of seconds since UNIX epoch (January 1, 1970).
ctime()
Convert number of seconds since UNIX epoch to date.
pp()
A string describing the probe point currently being handled.
thread_indent()
This particular function is quite useful, providing you with a way to better organize your print
results. The function takes one argument, an indentation delta, which indicates how many spaces
to add or remove from a thread's "indentation counter". It then returns a string with some generic
trace data along with an appropriate number of indentation spaces.
14
instructs SystemTap to probe all entries to the system
uses the SystemTap functions execname() (name
Need help?
Do you have a question about the ENTERPRISE LINUX 5.4 - SYSTEMTAP BEGINNERS GUIDE and is the answer not in the manual?
Questions and answers