diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/ChangeLog | 41 | ||||
-rw-r--r-- | testsuite/Makefile.am | 3 | ||||
-rw-r--r-- | testsuite/Makefile.in | 3 | ||||
-rwxr-xr-x | testsuite/configure | 20 | ||||
-rw-r--r-- | testsuite/configure.ac | 2 | ||||
-rwxr-xr-x | testsuite/systemtap.base/bz5274.exp | 13 | ||||
-rw-r--r-- | testsuite/systemtap.base/bz6850.exp | 13 | ||||
-rw-r--r-- | testsuite/systemtap.base/static_uprobes.exp | 185 | ||||
-rw-r--r-- | testsuite/systemtap.base/uprobes.exp | 14 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.html | 3 | ||||
-rw-r--r-- | testsuite/systemtap.examples/index.txt | 12 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.html | 3 | ||||
-rw-r--r-- | testsuite/systemtap.examples/keyword-index.txt | 12 | ||||
-rw-r--r-- | testsuite/systemtap.examples/memory/kmalloc-top.meta | 4 | ||||
-rw-r--r-- | testsuite/systemtap.examples/memory/pfaults.meta | 13 | ||||
-rw-r--r-- | testsuite/systemtap.examples/memory/pfaults.stp | 35 | ||||
-rw-r--r-- | testsuite/systemtap.samples/pfaults.exp | 16 | ||||
-rw-r--r-- | testsuite/systemtap.samples/pfaults.stp | 58 |
18 files changed, 259 insertions, 191 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 6afd1df8..1c3693c0 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,44 @@ +2009-02-17 Frank Ch. Eigler <fche@elastic.org> + + * systemtap.base/static_uprobes.exp: Handle $srcdir != $builddir. + +2009-02-17 Mark Wielaard <mjw@redhat.com> + + * Makefile.am: Set SYSTEMTAP_INCLUDES. + * systemtap.base/static_uprobes.exp: Always run the compile tests, + use SYSTEMTAP_INCLUDES to find sys/sdt.h, use SYSTEMTAP_PATH to + find dtrace script. + * Makefile.in: Regenerated. + * aclocal.m4: Likewise. + * configure: Likewise. + +2009-02-16 David Smith <dsmith@redhat.com> + + * systemtap.base/bz5274.exp: Better cleanup. + * systemtap.base/bz6850.exp: Ditto. + * systemtap.base/uprobes.exp: Ditto. + * systemtap.base/static_uprobes.exp: Ditto. Also changed a + 'spawn' to an 'exec' to avoid needing to wait. + +2009-02-15 Stan Cox <scox@redhat.com> + + * systemtap.base/static_uprobes.exp: Test with both c++ and c. + +2009-02-10 Will Cohen <wcohen@redhat.com> + + * systemtap.examples/memory/kmalloc-top.meta: Correct testing commands. + +2009-02-10 Will Cohen <wcohen@redhat.com> + + * systemtap.samples/pfaults.exp: + * systemtap.samples/pfaults.stp: Removed. + * systemtap.examples/memory/pfaults.stp: Revised version from samples. + * systemtap.examples/memory/pfaults.meta: New + * systemtap.examples/index.html: + * systemtap.examples/index.txt: + * systemtap.examples/keyword-index.html: + * systemtap.examples/keyword-index.txt: Regenerate. + 2009-02-11 Tim Moore <timoore@redhat.com> * systemtap.examples/profiling/latencytap.stp: Use _stp_stack_snprint_tsk. diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 9516fec4..9607ebe3 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -33,7 +33,8 @@ SYSTEMTAP_TAPSET=$(DESTDIR)$(pkgdatadir)/tapset LD_LIBRARY_PATH=$(DESTDIR)$(libdir)/systemtap CRASH_LIBDIR=$(DESTDIR)$(libdir)/systemtap SYSTEMTAP_PATH=$(DESTDIR)$(bindir) +SYSTEMTAP_INCLUDES=$(DESTDIR)$(includedir) RUNTESTDEFAULTFLAGS = --tool $$tool --tool_opts \'$(TOOL_OPTS)\' --srcdir $$srcdir EXPECT = expect -RUNTEST="env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH $(srcdir)/execrc runtest" +RUNTEST="env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH SYSTEMTAP_PATH=$(SYSTEMTAP_PATH) SYSTEMTAP_INCLUDES=$(SYSTEMTAP_INCLUDES) $(srcdir)/execrc runtest" diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in index 4e9f9374..fa96c224 100644 --- a/testsuite/Makefile.in +++ b/testsuite/Makefile.in @@ -127,9 +127,10 @@ SYSTEMTAP_TAPSET = $(DESTDIR)$(pkgdatadir)/tapset LD_LIBRARY_PATH = $(DESTDIR)$(libdir)/systemtap CRASH_LIBDIR = $(DESTDIR)$(libdir)/systemtap SYSTEMTAP_PATH = $(DESTDIR)$(bindir) +SYSTEMTAP_INCLUDES = $(DESTDIR)$(includedir) RUNTESTDEFAULTFLAGS = --tool $$tool --tool_opts \'$(TOOL_OPTS)\' --srcdir $$srcdir EXPECT = expect -RUNTEST = "env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH $(srcdir)/execrc runtest" +RUNTEST = "env SYSTEMTAP_RUNTIME=$(SYSTEMTAP_RUNTIME) SYSTEMTAP_TAPSET=$(SYSTEMTAP_TAPSET) LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) CRASH_LIBDIR=$(CRASH_LIBDIR) PATH=$(SYSTEMTAP_PATH):$$PATH SYSTEMTAP_PATH=$(SYSTEMTAP_PATH) SYSTEMTAP_INCLUDES=$(SYSTEMTAP_INCLUDES) $(srcdir)/execrc runtest" all: all-am .SUFFIXES: diff --git a/testsuite/configure b/testsuite/configure index 3c02bf56..094f99c7 100755 --- a/testsuite/configure +++ b/testsuite/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for systemtap 0.8. +# Generated by GNU Autoconf 2.61 for systemtap 0.9. # # Report bugs to <systemtap@sources.redhat.com>. # @@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='systemtap' PACKAGE_TARNAME='systemtap' -PACKAGE_VERSION='0.8' -PACKAGE_STRING='systemtap 0.8' +PACKAGE_VERSION='0.9' +PACKAGE_STRING='systemtap 0.9' PACKAGE_BUGREPORT='systemtap@sources.redhat.com' ac_subst_vars='SHELL @@ -1149,7 +1149,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures systemtap 0.8 to adapt to many kinds of systems. +\`configure' configures systemtap 0.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1215,7 +1215,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of systemtap 0.8:";; + short | recursive ) echo "Configuration of systemtap 0.9:";; esac cat <<\_ACEOF @@ -1291,7 +1291,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -systemtap configure 0.8 +systemtap configure 0.9 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1305,7 +1305,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by systemtap $as_me 0.8, which was +It was created by systemtap $as_me 0.9, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1997,7 +1997,7 @@ fi # Define the identity of the package. PACKAGE='systemtap' - VERSION='0.8' + VERSION='0.9' cat >>confdefs.h <<_ACEOF @@ -2617,7 +2617,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by systemtap $as_me 0.8, which was +This file was extended by systemtap $as_me 0.9, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2660,7 +2660,7 @@ Report bugs to <bug-autoconf@gnu.org>." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -systemtap config.status 0.8 +systemtap config.status 0.9 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/testsuite/configure.ac b/testsuite/configure.ac index f24bf23b..c40fdf72 100644 --- a/testsuite/configure.ac +++ b/testsuite/configure.ac @@ -1,7 +1,7 @@ dnl configure.ac --- autoconf input file for systemtap testsuite dnl Process this file with autoconf to produce a configure script. -AC_INIT([systemtap], 0.8, systemtap@sources.redhat.com, systemtap) +AC_INIT([systemtap], 0.9, systemtap@sources.redhat.com, systemtap) AC_PREREQ(2.59) AC_CONFIG_AUX_DIR(..) diff --git a/testsuite/systemtap.base/bz5274.exp b/testsuite/systemtap.base/bz5274.exp index db0e0a46..92441e9e 100755 --- a/testsuite/systemtap.base/bz5274.exp +++ b/testsuite/systemtap.base/bz5274.exp @@ -8,11 +8,14 @@ if {$arch == "ppc64"} { catch {exec gcc -o $test -g $srcdir/$subdir/$test.c} err } - if {$err == "" && [file exists $test]} then { pass "$test compile" } else {fail "$test compile"} -if {! [installtest_p]} { untested "$test -p5"; return } +if {! [installtest_p]} { + catch {exec rm -f $test} + untested "$test -p5" + return +} # Try to find utrace_attach symbol in /proc/kallsyms # copy from utrace_p5.exp @@ -21,7 +24,11 @@ set path "/proc/kallsyms" if {! [catch {exec grep -q utrace_attach $path} dummy]} { set utrace_support_found 1 } -if {$utrace_support_found == 0} { untested "$test -p5"; return } +if {$utrace_support_found == 0} { + catch {exec rm -f $test} + untested "$test -p5" + return +} if {[catch {exec stap $tpath.stp -c "$srcdir/$subdir/$test.sh"} res]} { untested "$test longjmp to a uretprobed function" diff --git a/testsuite/systemtap.base/bz6850.exp b/testsuite/systemtap.base/bz6850.exp index 73fedc8a..b96ed95c 100644 --- a/testsuite/systemtap.base/bz6850.exp +++ b/testsuite/systemtap.base/bz6850.exp @@ -10,12 +10,21 @@ set path "/proc/kallsyms" if {! [catch {exec grep -q utrace_attach $path} dummy]} { set utrace_support_found 1 } -if {$utrace_support_found == 0} { untested "$test -p4"; untested "$test -p5"; return } +if {$utrace_support_found == 0} { + catch {exec rm -f $test} + untested "$test -p4" + untested "$test -p5" + return +} set rc [stap_run_batch $srcdir/$subdir/bz6850.stp] if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } -if {! [installtest_p]} { untested "$test -p5"; return } +if {! [installtest_p]} { + catch {exec rm -f $test} + untested "$test -p5" + return +} # Pick up the stap being tested. set stapexe [exec /usr/bin/which stap] diff --git a/testsuite/systemtap.base/static_uprobes.exp b/testsuite/systemtap.base/static_uprobes.exp index eb0d1c6e..6c0f83a8 100644 --- a/testsuite/systemtap.base/static_uprobes.exp +++ b/testsuite/systemtap.base/static_uprobes.exp @@ -1,21 +1,16 @@ + set test "sduprobes" -if {![installtest_p]} {untested $test; return} # Compile a C program to use as the user-space probing target set sup_srcpath "[pwd]/static_uprobes.c" set sup_exepath "[pwd]/static_uprobes.x" -set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-L$env(CRASH_LIBDIR) additional_flags=-lsduprobes" set fp [open $sup_srcpath "w"] puts $fp " #include <stdlib.h> #define USE_STAP_PROBE 1 #include \"static_uprobes.h\" -foo () -{ - STAP_PROBE(static_uprobes,test_probe_1); -} - +void bar (int i) { if (i == 0) @@ -23,6 +18,7 @@ bar (int i) STAP_PROBE1(static_uprobes,test_probe_2,i); } +void baz (int i, char* s) { STAP_PROBE1(static_uprobes,test_probe_0,i); @@ -31,102 +27,31 @@ baz (int i, char* s) STATIC_UPROBES_TEST_PROBE_3(i,s); } +void buz (int parm) { + if (parm == 0) + parm = 1000; + DTRACE_PROBE1(static_uprobes,test_probe_4,parm); } +int main () { - sleep(5); - foo(); bar(2); - baz(3,\"abc\"); + baz(3,(char*)\"abc\"); buz(4); } " close $fp -# set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] -# if { $res != "" } { -# verbose "target_compile failed: $res" 2 -# fail "compiling static_uprobes.c" -# return -# } else { -# pass "compiling static_uprobes.c" -# } - -set fp [open "[pwd]/static_uprobes.stp" "w"] +set sup_stppath "[pwd]/static_uprobes.stp" +set fp [open $sup_stppath "w"] puts $fp " probe process(\"static_uprobes.x\").mark(\"test_probe_0\") { printf(\"In test_probe_0 probe %#x\\n\", \$arg1) } -probe process(\"static_uprobes.x\").mark(\"test_probe_1\") -{ - printf(\"In test_probe_1 probe\\n\") -} -probe process(\"static_uprobes.x\").mark(\"test_probe_2\") -{ - printf(\"In test_probe_2 probe %#x\\n\", \$arg1) -} -probe process(\"static_uprobes.x\").mark(\"test_probe_3\") -{ - printf(\"In test_probe_3 probe %#x %#x\\n\", \$arg1, \$arg2) -} -" -close $fp - -# Try to find utrace_attach symbol in /proc/kallsyms -# copy from utrace_p5.exp -set utrace_support_found 0 -set path "/proc/kallsyms" -if {! [catch {exec grep -q utrace_attach $path} dummy]} { - set utrace_support_found 1 -} -if {$utrace_support_found == 0} { untested "$test"; return } - -set ok 0 -# verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -# spawn stap -c $sup_exepath [pwd]/static_uprobes.stp -# expect { -# -timeout 180 -# -re {In test_probe_1 probe} { incr ok; exp_continue } -# -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } -# -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } -# -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } -# timeout { fail "$test (timeout)" } -# eof { } -# } - -# if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } -set ok 0 - -# Now do a debuginfo style probe of the above test - -set fp [open "[pwd]/static_uprobes.sh" "w"] -puts $fp " -ed $sup_srcpath <<HERE -/USE_STAP_PROBE/d -/buz/+1 -a - DTRACE_PROBE1(static_uprobes,test_probe_4,parm); -. -w -q -" -close $fp -spawn sh [pwd]/static_uprobes.sh - -set fp [open "[pwd]/static_uprobes.stp" "w"] -puts $fp " -probe process(\"static_uprobes.x\").mark(\"test_probe_0\") -{ - printf(\"In test_probe_0 probe %#x\\n\", \$arg1) -} -probe process(\"static_uprobes.x\").mark(\"test_probe_1\") -{ - printf(\"In test_probe_1 probe\\n\") -} probe process(\"static_uprobes.x\").mark(\"test_probe_2\") { printf(\"In test_probe_2 probe %#x\\n\", \$arg1) @@ -142,7 +67,9 @@ probe process(\"static_uprobes.x\").mark(\"test_probe_4\") " close $fp -set fp [open "[pwd]/static_uprobes.d" "w"] +set sup_dpath "[pwd]/static_uprobes.d" +set sup_hpath "[pwd]/static_uprobes.h" +set fp [open $sup_dpath "w"] puts $fp " provider static_uprobes { probe test_probe_1 (); @@ -152,20 +79,89 @@ provider static_uprobes { }; " close $fp -spawn dtrace -h -s [pwd]/static_uprobes.d +if {[installtest_p]} { + set dtrace $env(SYSTEMTAP_PATH)/dtrace +} else { + set dtrace $srcdir/../dtrace +} +exec $dtrace -h -s $sup_dpath +if {[file exists $sup_hpath]} then { + pass "generating $sup_hpath" +} else { + fail "generating $sup_hpath" + catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} + return +} + +catch {exec rm -f $sup_dpath} + +if {[installtest_p]} { + set sdtdir $env(SYSTEMTAP_INCLUDES) +} else { + set sdtdir $srcdir/../includes +} + +set sup_flags "additional_flags=-I$sdtdir additional_flags=-g additional_flags=-O additional_flags=-I." +set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] +if { $res != "" } { + verbose "target_compile failed: $res" 2 + fail "compiling $sup_srcpath -g" + catch {exec rm -f $sup_srcpath $sup_hpath $sup_stppath} + return +} else { + pass "compiling $sup_srcpath -g" +} -set sup_flags "additional_flags=-iquote$env(SYSTEMTAP_RUNTIME) additional_flags=-g additional_flags=-O additional_flags=-I." +spawn mv $sup_srcpath "[pwd]/static_uprobes.cc" +set sup_srcpath "[pwd]/static_uprobes.cc" +set sup_flags "$sup_flags c++" set res [target_compile $sup_srcpath $sup_exepath executable $sup_flags] if { $res != "" } { verbose "target_compile failed: $res" 2 - fail "compiling sduprobes.c -g" + fail "compiling $sup_srcpath -g" + catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} return } else { - pass "compiling sduprobes.c -g" + pass "compiling $sup_srcpath -g" +} + +if {![installtest_p]} {untested $test; return} + +# Try to find utrace_attach symbol in /proc/kallsyms +# copy from utrace_p5.exp +set utrace_support_found 0 +set path "/proc/kallsyms" +if {! [catch {exec grep -q utrace_attach $path} dummy]} { + set utrace_support_found 1 +} +if {$utrace_support_found == 0} { + untested "$test" + catch {exec rm -f $sup_srcpath} + return +} + +set ok 0 + +verbose -log "spawn stap -c $sup_exepath $sup_stppath" +spawn stap -c $sup_exepath $sup_stppath +expect { + -timeout 180 + -re {In test_probe_2 probe 0x2} { incr ok; exp_continue } + -re {In test_probe_0 probe 0x3} { incr ok; exp_continue } + -re {In test_probe_3 probe 0x3 0x[0-9a-f][0-9a-f]} { incr ok; exp_continue } + -re {In test_probe_4 dtrace probe 0x4} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } } -verbose -log "spawn stap -c $sup_exepath [pwd]/static_uprobes.stp" -spawn stap -c $sup_exepath [pwd]/static_uprobes.stp +wait + +if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } + +set ok 0 + +verbose -log "spawn stap -c $sup_exepath $sup_stppath" +spawn stap -c $sup_exepath $sup_stppath expect { -timeout 180 -re {In test_probe_1 probe} { incr ok; exp_continue } @@ -179,4 +175,5 @@ expect { wait -if {$ok == 5} { pass "$test" } { fail "$test ($ok)" } +if {$ok == 4} { pass "$test" } { fail "$test ($ok)" } +catch {exec rm -f $sup_srcpath $sup_exepath $sup_hpath $sup_stppath} diff --git a/testsuite/systemtap.base/uprobes.exp b/testsuite/systemtap.base/uprobes.exp index e8318586..89250e7b 100644 --- a/testsuite/systemtap.base/uprobes.exp +++ b/testsuite/systemtap.base/uprobes.exp @@ -25,12 +25,20 @@ set path "/proc/kallsyms" if {! [catch {exec grep -q utrace_attach $path} dummy]} { set utrace_support_found 1 } -if {$utrace_support_found == 0} { untested "$test -p4"; untested "$test -p5"; return } +if {$utrace_support_found == 0} { + untested "$test -p4"; untested "$test -p5" + catch {exec rm -f jennie.c jennie} + return +} set rc [stap_run_batch $srcdir/$subdir/uprobes.stp] if {$rc == 0} then { pass "$test -p4" } else { fail "$test -p4" } -if {! [installtest_p]} { untested "$test -p5"; exec rm -f jennie.c jennie; return } +if {! [installtest_p]} { + untested "$test -p5"; + catch {exec rm -f jennie.c jennie} + return +} # Pick up the stap being tested. set stapexe [exec /usr/bin/which stap] @@ -46,4 +54,4 @@ expect { if {$ok == 10} then { pass "$test -p5" } else { fail "$test -p5 ($ok)" } catch {wait; close} -exec rm -f jennie.c jennie +catch {exec rm -f jennie.c jennie} diff --git a/testsuite/systemtap.examples/index.html b/testsuite/systemtap.examples/index.html index 5c6e2fdb..7b76baa1 100644 --- a/testsuite/systemtap.examples/index.html +++ b/testsuite/systemtap.examples/index.html @@ -76,6 +76,9 @@ keywords: <a href="keyword-index.html#IO">IO</a> <br> <li><a href="memory/kmalloc-top">memory/kmalloc-top</a> - Show Paths to Kernel Malloc (kmalloc) Invocations<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> <p>The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e).</p></li> +<li><a href="memory/pfaults.stp">memory/pfaults.stp</a> - Generate Log of Major and Minor Page Faults<br> +keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> +<p>The pfaults.stp script generates a simple log for each major and minor page fault that occurs on the system. Each line contains a timestamp (in microseconds) when the page fault servicing was completed, the pid of the process, the address of the page fault, the type of access (read or write), the type of fault (major or minor), and the elapsed time for page fault. This log can be examined to determine where the page faults are occuring.</p></li> <li><a href="network/nettop.stp">network/nettop.stp</a> - Periodic Listing of Processes Using Network Interfaces<br> keywords: <a href="keyword-index.html#NETWORK">NETWORK</a> <a href="keyword-index.html#TRAFFIC">TRAFFIC</a> <a href="keyword-index.html#PER-PROCESS">PER-PROCESS</a> <br> <p>Every five seconds the nettop.stp script prints out a list of processed (PID and command) with the number of packets sent/received and the amount of data sent/received by the process during that interval.</p></li> diff --git a/testsuite/systemtap.examples/index.txt b/testsuite/systemtap.examples/index.txt index dd5b990a..fdcd3b31 100644 --- a/testsuite/systemtap.examples/index.txt +++ b/testsuite/systemtap.examples/index.txt @@ -111,6 +111,18 @@ keywords: memory counts (-m), or exclude certain stack traces (-e). +memory/pfaults.stp - Generate Log of Major and Minor Page Faults +keywords: memory + + The pfaults.stp script generates a simple log for each major and + minor page fault that occurs on the system. Each line contains a + timestamp (in microseconds) when the page fault servicing was + completed, the pid of the process, the address of the page fault, the + type of access (read or write), the type of fault (major or minor), + and the elapsed time for page fault. This log can be examined to + determine where the page faults are occuring. + + network/nettop.stp - Periodic Listing of Processes Using Network Interfaces keywords: network traffic per-process diff --git a/testsuite/systemtap.examples/keyword-index.html b/testsuite/systemtap.examples/keyword-index.html index dd52943a..b3ea0943 100644 --- a/testsuite/systemtap.examples/keyword-index.html +++ b/testsuite/systemtap.examples/keyword-index.html @@ -132,6 +132,9 @@ keywords: <a href="keyword-index.html#SYSCALL">SYSCALL</a> <a href="keyword-inde <li><a href="memory/kmalloc-top">memory/kmalloc-top</a> - Show Paths to Kernel Malloc (kmalloc) Invocations<br> keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> <p>The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e).</p></li> +<li><a href="memory/pfaults.stp">memory/pfaults.stp</a> - Generate Log of Major and Minor Page Faults<br> +keywords: <a href="keyword-index.html#MEMORY">MEMORY</a> <br> +<p>The pfaults.stp script generates a simple log for each major and minor page fault that occurs on the system. Each line contains a timestamp (in microseconds) when the page fault servicing was completed, the pid of the process, the address of the page fault, the type of access (read or write), the type of fault (major or minor), and the elapsed time for page fault. This log can be examined to determine where the page faults are occuring.</p></li> </ul> <h3><a name="NETWORK">NETWORK</a></h3> <ul> diff --git a/testsuite/systemtap.examples/keyword-index.txt b/testsuite/systemtap.examples/keyword-index.txt index 5679474f..5f382e75 100644 --- a/testsuite/systemtap.examples/keyword-index.txt +++ b/testsuite/systemtap.examples/keyword-index.txt @@ -206,6 +206,18 @@ keywords: memory counts (-m), or exclude certain stack traces (-e). +memory/pfaults.stp - Generate Log of Major and Minor Page Faults +keywords: memory + + The pfaults.stp script generates a simple log for each major and + minor page fault that occurs on the system. Each line contains a + timestamp (in microseconds) when the page fault servicing was + completed, the pid of the process, the address of the page fault, the + type of access (read or write), the type of fault (major or minor), + and the elapsed time for page fault. This log can be examined to + determine where the page faults are occuring. + + = NETWORK = network/nettop.stp - Periodic Listing of Processes Using Network Interfaces diff --git a/testsuite/systemtap.examples/memory/kmalloc-top.meta b/testsuite/systemtap.examples/memory/kmalloc-top.meta index 2dfbf898..93308909 100644 --- a/testsuite/systemtap.examples/memory/kmalloc-top.meta +++ b/testsuite/systemtap.examples/memory/kmalloc-top.meta @@ -9,5 +9,5 @@ exit: user-controlled output: sorted-list scope: system-wide description: The kmalloc-top perl program runs a small systemtap script to collect stack traces for each call to the kmalloc function and counts the time that each stack trace is observed. When kmalloc-top exits it prints out sorted list. The output can be be filtered to print only only the first stack traces (-t) stack traces with more a minimum counts (-m), or exclude certain stack traces (-e). -test_check: kmalloc-top -o "-p4" -c "sleep 0" -test_installcheck: kmalloc-top -c "sleep 1" +test_check: ./kmalloc-top -o "-p4" -c "sleep 0" +test_installcheck: ./kmalloc-top -c "sleep 1" diff --git a/testsuite/systemtap.examples/memory/pfaults.meta b/testsuite/systemtap.examples/memory/pfaults.meta new file mode 100644 index 00000000..149d83fa --- /dev/null +++ b/testsuite/systemtap.examples/memory/pfaults.meta @@ -0,0 +1,13 @@ +title: Generate Log of Major and Minor Page Faults +name: pfaults.stp +version: 1.0 +author: anonymous +keywords: memory +subsystem: memory +status: production +exit: user-controlled +output: sorted-list +scope: system-wide +description: The pfaults.stp script generates a simple log for each major and minor page fault that occurs on the system. Each line contains a timestamp (in microseconds) when the page fault servicing was completed, the pid of the process, the address of the page fault, the type of access (read or write), the type of fault (major or minor), and the elapsed time for page fault. This log can be examined to determine where the page faults are occuring. +test_check: stap -p4 pfaults.stp +test_installcheck: stap pfaults.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/memory/pfaults.stp b/testsuite/systemtap.examples/memory/pfaults.stp new file mode 100644 index 00000000..5bf1a8a6 --- /dev/null +++ b/testsuite/systemtap.examples/memory/pfaults.stp @@ -0,0 +1,35 @@ +#! /usr/bin/env stap + +global fault_entry_time, fault_address, fault_access +global time_offset + +probe begin { time_offset = gettimeofday_us() } + +probe vm.pagefault { + t = gettimeofday_us() + p = pid() + fault_entry_time[p] = t + fault_address[p] = address + fault_access[p] = write_access ? "w" : "r" +} + +probe vm.pagefault.return { + t=gettimeofday_us() + p = pid() + if (!(p in fault_entry_time)) next + e = t - fault_entry_time[p] + if (vm_fault_contains(fault_type,VM_FAULT_MINOR)) { + ftype="minor" + } else if (vm_fault_contains(fault_type,VM_FAULT_MAJOR)) { + ftype="major" + } else { + next #only want to deal with minor and major page faults + } + + printf("%d:%d:%p:%s:%s:%d\n", + t - time_offset, p, fault_address[p], fault_access[p], ftype, e) + #free up memory + delete fault_entry_time[p] + delete fault_address[p] + delete fault_access[p] +} diff --git a/testsuite/systemtap.samples/pfaults.exp b/testsuite/systemtap.samples/pfaults.exp deleted file mode 100644 index 2cab7c14..00000000 --- a/testsuite/systemtap.samples/pfaults.exp +++ /dev/null @@ -1,16 +0,0 @@ -set test "pfaults" -if {![installtest_p]} { untested $test; return } - -spawn stap -DMAXACTION=10000 -g $srcdir/$subdir/pfaults.stp -set pid $spawn_id -set ok 0 -expect { - -timeout 240 - -re {Page fault tracking, start time[^\r\n]+\r\n} { incr ok; exp_continue } - -re {Page fault tracking, end time[^\r\n]+\r\n} { incr ok; exp_continue } - timeout { fail "$test (timeout)" } - eof { } -} -#FIXME does not handle case of hanging pfaults.stp correctly -wait -if {$ok == 2} { pass "$test ($ok)" } { fail "$test ($ok)" } diff --git a/testsuite/systemtap.samples/pfaults.stp b/testsuite/systemtap.samples/pfaults.stp deleted file mode 100644 index 577e93cd..00000000 --- a/testsuite/systemtap.samples/pfaults.stp +++ /dev/null @@ -1,58 +0,0 @@ -#! /usr/bin/env stap - -global pidnames, faults, fault_types - -probe vm.pagefault { - # Maintain a pid-to-execname mapping. This logic should get transplanted - # into a tapset script that is automatically included upon reference to - # its exported global variable. - pidnames[pid()] = execname() - - faults [pid(), $write_access ? 1 : 0] ++ -} - -probe vm.pagefault.return { - fault_types [pid(), $return] ++ -} - - -# Some constants, to come from a future "VM tapset" - -global VM_FAULT_OOM, VM_FAULT_SIGBUS, VM_FAULT_MINOR, VM_FAULT_MAJOR -probe begin { - VM_FAULT_OOM=-1 - VM_FAULT_SIGBUS=0 - VM_FAULT_MINOR=1 - VM_FAULT_MAJOR=2 -} - - -# Shut down the probing session after a while -probe timer.ms(1000) { report() } -probe timer.ms(10000) { exit() } - -function _(n) { return sprint(n) } # let's abbreviate - -function report () { - print ("time=" . _(gettimeofday_s()) . "\n") - foreach ([pid] in pidnames) { - if (faults[pid,0]+faults[pid,1] == 0) continue - print (pidnames[pid] . "[" . _(pid) . "]" . - " reads=" . _(faults[pid,0]) . - " writes=" . _(faults[pid,1]) . - " oom=" . _(fault_types[pid,VM_FAULT_OOM]) . - " sigbus=" . _(fault_types[pid,VM_FAULT_SIGBUS]) . - " minor=" . _(fault_types[pid,VM_FAULT_MINOR]) . - " major=" . _(fault_types[pid,VM_FAULT_MAJOR]) . - "\n") - } - delete faults - delete fault_types -} - -probe begin { - print ("Page fault tracking, start time=" . _(gettimeofday_s()) . "\n") -} -probe end { - print ("Page fault tracking, end time=" . _(gettimeofday_s()) . "\n") -} |