diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/ChangeLog | 11 | ||||
-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/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 |
9 files changed, 89 insertions, 74 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 6afd1df8..015ee3d3 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,14 @@ +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/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/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") -} |