diff options
Diffstat (limited to 'doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml')
-rw-r--r-- | doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml b/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml index b1f40669..fccf0469 100644 --- a/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml +++ b/doc/SystemTap_Beginners_Guide/en-US/ScriptConstructs.xml @@ -71,18 +71,22 @@ if (<replaceable>condition</replaceable>) <example id="simpleifelseexample"> <title>ifelse.stp</title> <programlisting> -global countread, countnonread
-probe kernel.function("vfs_read"),kernel.function("vfs_write")
-{
- if (probefunc()=="vfs_read") {
- countread ++ }
- else {countnonread ++}
-}
-probe timer.s(5) { exit() }
-probe end
-{
- printf("VFS reads total %d\n VFS writes total %d\n", countread, countnonread)
-}
+global countread, countnonread +probe kernel.function("vfs_read"),kernel.function("vfs_write") +{ + if (probefunc()=="vfs_read") { + countread ++ + } + else { + countnonread ++ + } +} +probe timer.s(5) { exit() } +probe end +{ + printf("VFS reads total %d\n VFS writes total %d\n", countread, countnonread) +} + </programlisting> </example> |