System information

78 System Analysis and Tuning Guide
Synchronous events: Occur when any process executes an instruction at a particu-
lar location in kernel code. This gives other events a reference point (instruction ad-
dress) from which more contextual data may be available.
An example for a synchronous event is vfs.file_operation: The entry to
the file_operation event for Virtual File System (VFS). For example, in Sec-
tion5.2, “Installation and Setup” (page74), read is the file_operation
event used for VFS.
Asynchronous events: Not tied to a particular instruction or location in code. This
family of probe points consists mainly of counters, timers, and similar constructs.
Examples for asynchronous events are: begin (start of a SystemTap session—
as soon as a SystemTap script is run, end (end of a SystemTap session), or timer
events. Timer events specify a handler to be executed periodically, like example
timer.s(seconds), or timer.ms(milliseconds).
When used in conjunction with other probes that collect information, timer events
allow you to print out periodic updates and see how that information changes over
time.
Example5.2: Probe with Timer Event
For example, the following probe would print the text “hello world” every 4 seconds:
probe timer.s(4)
{
printf("hello world\n")
}
For detailed information about supported events, refer to the stapprobes man
page. The See Also section of the man page also contains links to other man pages that
discuss supported events for specific subsystems and components.
5.3.3 SystemTap Handlers (Probe Body)
Each SystemTap event is accompanied by a corresponding handler defined for that
event, consisting of a statement block.
5.3.3.1 Functions
If you need the same set of statements in multiple probes, you can place them in a
function for easy reuse. Functions are defined by the keyword function followed