From b866b7adfac0649db534a98b723b13692c1da4d9 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Mon, 8 Dec 2008 22:37:17 -0500 Subject: Edits to Scripts.xml and ScriptConstructs.xml. --- doc/SystemTap_Beginners_Guide/en-US/Scripts.xml | 75 +++++++++++++++---------- 1 file changed, 46 insertions(+), 29 deletions(-) (limited to 'doc/SystemTap_Beginners_Guide/en-US/Scripts.xml') diff --git a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml index e6ffc4ef..a0fc7d52 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/Scripts.xml @@ -159,18 +159,16 @@ probe event {statements} Each probe has a corresponding statement block. This statement block is - enclosed in braces ({ }) and contains the handlers to be executed per event. - SystemTap executes these handlers (i.e. "statements") in sequence; special separators or - terminators are generally not necessary between multiple handlers. + enclosed in braces ({ }) and contains the statements to be executed per event. + SystemTap executes these statements in sequence; special separators or + terminators are generally not necessary between multiple statements. Note Statement blocks in SystemTap scripts follow the same syntax and semantics as the C - programming language. A statement block can also nest another statement block, although - for the most part this is used only to organize code in the script for the benefit of the - administrator. + programming language. A statement block can be nested within another statement block. @@ -247,7 +245,7 @@ probe event {function_name A synchronous event occurs when any process - executes an instruction that references a particular location in kernel + executes an instruction at a particular location in kernel code. This gives other events a reference point from which more contextual data may be available. @@ -351,7 +349,7 @@ probe event {function_name events wildcards - When defining functions, you can use asterisk (*) + When defining probe events, you can use asterisk (*) for wildcards. You can also trace the entry or exit of a function in a kernel source file. Consider the following example: @@ -364,14 +362,15 @@ probe kernel.function("*@net/socket.c").return { } - Wild cards also work for other things, e.g. syscall.* + Wild cards also work for other types of events, e.g. syscall.* In the previous example, the first probe's event specifies the entry of ALL functions in the kernel source file net/socket.c. The second probe specifies the - exit of all those functions. Note that in this example, no handler - was specified; as such, no information will be displayed. + exit of all those functions. Note that in this example, + there are no statements in the handler; + as such, no information will be collected or displayed. @@ -399,11 +398,19 @@ probe module("ext3").function("*").return { } - The first probe in points to the entry of all functions for the ext3 module. The second probe points to the exits of all entries for that same module; the use of the .return suffix is similar to kernel.function(). Note that the probes in also do not contain probe bodies, and as such will not print any useful data (as in ). - + The first probe in + points to the entry of all functions for + the ext3 module. The second probe points to + the exits of all functions for that same module; the use of the + .return suffix is similar to + kernel.function(). Note that the probes in + do not contain statements + in the probe handlers, and as such will not print any useful + data (as in ). + - A system's loaded modules are typically located in /lib/modules/kernel version, where kernel version refers to the currently loaded kernel. Modules use the filename extension .ko. + A system's kernel modules are typically located in /lib/modules/kernel_version, where kernel_version refers to the currently loaded kernel version. Modules use the filename extension .ko. @@ -482,8 +489,8 @@ probe module("ext3").function("*").return { } - An event that specifies a handler to be executed every specified - period of time. For example: + An event that specifies a handler to be executed periodically. + For example: timer-s.stp @@ -601,7 +608,7 @@ probe begin -printf ("format string\n", argument) +printf ("format string\n", arguments) printf() @@ -614,7 +621,7 @@ printf ("format string\n", argument The format string specifies how - argument should be printed. The format string + arguments should be printed. The format string of simply instructs SystemTap to print hello world, and contains no format specifiers. @@ -672,8 +679,8 @@ probe syscall.open instructs SystemTap to probe all entries to the system call open; for each event, it prints the - current execname() (which is a string) and - pid() (which is a number), followed by the word + 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: @@ -827,6 +834,15 @@ hald(2360) open The number of seconds since UNIX epoch (January 1, 1970). + + + ctime() + + + Convert number of seconds since UNIX epoch to date. + + +