diff options
Diffstat (limited to 'testsuite/systemtap.examples')
-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 |
7 files changed, 80 insertions, 2 deletions
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] +} |