summaryrefslogtreecommitdiffstats
path: root/examples
diff options
authorfche <fche>2008-11-19 18:02:13 +0000
committerfche <fche>2008-11-19 18:02:13 +0000
commitbeb5234b1ef526f6af60d1c1b8f6ec698966554e (patch)
treeedafd3355052c15469761f50b5be74537b87a7ca /examples
parentnone (diff)
remove other example snapshot stuff
Diffstat (limited to 'examples')
-rw-r--r--examples/README57
-rw-r--r--examples/demo_script.txt103
-rw-r--r--examples/general/graphs.stp60
-rw-r--r--examples/general/helloworld.stp2
-rw-r--r--examples/general/para-callgraph.stp20
-rw-r--r--examples/gitweb.php8
-rw-r--r--examples/html/systemtap.css164
-rw-r--r--examples/html/systemtapcorner.gifbin970 -> 0 bytes
-rw-r--r--examples/html/systemtaplogo.pngbin1860 -> 0 bytes
-rw-r--r--examples/index.txt214
-rw-r--r--examples/io/disktop.stp69
-rw-r--r--examples/io/io_submit.stp71
-rw-r--r--examples/io/iotime.stp113
-rw-r--r--examples/io/iotop.stp25
-rw-r--r--examples/io/traceio.stp32
-rw-r--r--examples/io/traceio2.stp20
-rw-r--r--examples/keyword-index.txt458
-rw-r--r--examples/network/nettop.stp42
-rw-r--r--examples/network/socket-trace.stp8
-rw-r--r--examples/process/futexes.stp36
-rw-r--r--examples/process/pf2.stp16
-rw-r--r--examples/process/sig_by_pid.stp42
-rw-r--r--examples/process/sig_by_proc.stp36
-rw-r--r--examples/process/sigkill.stp23
-rw-r--r--examples/process/sleepingBeauties.stp58
-rw-r--r--examples/process/sleeptime.stp62
-rw-r--r--examples/process/syscalls_by_pid.stp28
-rw-r--r--examples/process/syscalls_by_proc.stp28
-rw-r--r--examples/process/wait4time.stp59
-rw-r--r--examples/profiling/functioncallcount.stp17
-rw-r--r--examples/profiling/thread-times.stp32
-rw-r--r--examples/subsystem-index.txt242
-rw-r--r--examples/systemtap.css164
-rw-r--r--examples/systemtapcorner.gifbin970 -> 0 bytes
-rw-r--r--examples/systemtaplogo.pngbin1860 -> 0 bytes
35 files changed, 4 insertions, 2305 deletions
diff --git a/examples/README b/examples/README
deleted file mode 100644
index e505bdfb..00000000
--- a/examples/README
+++ /dev/null
@@ -1,57 +0,0 @@
1This directory contains example scripts.
2
3Each script should be checked in as executable.
4
5The first line should be
6#! /usr/bin/env stap
7
8There should be an accompanying ".meta" file describing what the
9script does and how to use it, and how the testsuite should compile
10and run it. The meta files are also used to create a txt and html
11index (by keyword and subsystem) of all the examples by the
12examples-index-gen.pl script.
13
14The meta file contains the following elements. Each element (key and
15value) are on one line. If a key can have a list of values, the list
16elements are separated by spaces.
17
18title: Descriptive title for the script (required)
19name: the file name for the script, e.g. iotime.stp (required)
20version: versioning if any fixes and developed can be identified (required)
21author: name of author(s), "anonymous" if unknown (required)
22exclusivearch: Stated if the script can only run on some arches
23 this concept borrowed from rpm, matches types for rpm:
24 x86 i386 x86_64 ppc ppc64, s390 (optional)
25requires: Some scripts may require software to be available. In some cases
26 may need version numbering, e.g. kernel >= 2.6
27 Can have multiple "requires:" tags. (optional)
28keywords: List of likely words to categorize the script (required)
29 keywords are separated by spaces.
30 #FIXME have list of keyword
31subsystem: List what part of the kernel the instrumentation probes (required)
32 audit cpu blockio file filesystem locking memory numa network
33 process scheduler or user-space (probes are in the user-space)
34application: when user-space probing becomes available (optional)
35 a script might probe a particular application
36 this tag indicates the applicaton
37status: describes the state of development for the script (required)
38 proposed just an idea
39 experimental an implemented idea, but use at own risk
40 alpha
41 beta
42 production should be safe to use
43exit: how long do the script run? (required)
44 fixed exits in a fixed amount of time
45 user-controlled exits with "cntrl-c"
46 event-ended exits with some arbitrary event
47output: what kind of output does the script generate? (required)
48 trace histogram graph sorted batch timed
49scope: How much of the processes on the machine does the script watch?
50 system-wide or pid
51arg_[0-9]+: Describe what the arguments into the script are. (optional)
52description: A text description what the script does. (required)
53test_check: How to check that the example compiles.
54 (e.g. stap -p4 iotime.stp)
55test_installcheck: How to check that the example runs.
56 (e.g. stap iotime.stp -c "sleep 1")
57
diff --git a/examples/demo_script.txt b/examples/demo_script.txt
deleted file mode 100644
index 40408c4d..00000000
--- a/examples/demo_script.txt
+++ /dev/null
@@ -1,103 +0,0 @@
1> cd /root/systemtap
2
3A systemtap script can be as simple as a simgle line. For example,
4thge following script places a probepoint on the kernel sys_read()
5function and prints all callers with the function's arguments.
6
7>stap -e 'probe syscall.open {printf("%s: %s\n", execname(), argstr)}'
8
9Most script are a bit longer. (show top.stp)
10This script sets a probepoint on all kernel functions beginning with "sys_".
11When the probepoint is hit, it increments an entry in the map
12(or associative array) "syscalls" with the key "probefunc()" which returns
13the name of the function that was triggered. For example, "sys_read".
14
15There is a timer that is triggered every 5000ms or 5 seconds. That timer
16calls the function print_top(). print_top() sorts the syscalls map
17and prints the top 20 entries. Then it clears the map.
18
19> ./top.stp
20
21(after stopping "top" go ahead and enter "./sys.stp". It takes a minute
22to load this script. Diplay the source in another window and talk
23while it is loading.)
24
25The "top" script looked only at the functions called. If we want more
26detail about the functions, we can use systemtap to examine their local
27arguments and variables. However that would be difficult because each
28system call has different parameters. The Sycall Tapset solves
29this problem. To use it, we set probe points using the syntax "syscall.name"
30instead of kernel.function("sys_name"). The Syscall Tapset provides three
31defined variables we can use,
32name - the name of the function
33argstr - on function entry, a formatted string containing the arguments
34retstr - on function exit, the return value and possibly error code
35
36In this example, we filter out programs named "stpd" because this is
37part of the systemtap infrastructure. (It may be filtered out
38automatically in the future)
39
40The next example shows how you can use systemtap to focus on
41specific programs or pids. (show prof.stp)
42
43Like the "top" example, this script places probes on all kernel
44functions starting with "sys_". Only the probepoint also checks to see
45if the tid/pid matches the one returned by "target()" We'll show how
46the target pid is set later.
47
48Unlike the previous examples, this script sets a probe point on all the
49system call returns. When triggered, this probepoint computes the elapsed
50time since the function entry.
51
52To run this script, we must give it a pid to use for the target, or a
53program to run, in which case target will be its pid.
54
55> ./prof.stp -c "top -n5"
56
57--------------------------------
58
59Systemtap can also run in an unsafe mode where you can give
60it arbitrary C code to run at probepoints, or modify kernel variables
61and structures. This is very dangerous so only experts with root access will
62ever be permitted to do this.
63
64(show keyhack.stp)
65
66The next example will modify the local variable "keycode" in the "kdb_keycode"
67function in the kernel driver. We indicate it is a local variable by putting
68a dollar sign before the name.
69
70./keyhack.stp
71
72(prints error message)
73
74To tell systemtap we really want to run this script, we must use the "-g" flag.
75
76./keyhack.stp -g
77
78(type some keys. "m" should display as "b" in every window)
79
80This example is not something you would normally want to do. There are
81far better ways to remap a keyboard. What it demonstartes is that Systemtap
82can modify variables in a running kernel.
83
84(show kmalloc.stp)
85This next script shows the kind of statistics systemtap can collect.
86It collects information about kernel allocations.
87
88> ./kmalloc.stp
89
90Now we can refine this further
91(show kmalloc2.stp)
92
93Remember in some previous examples, we used maps or associative arrays. Maps can contain
94statistics too. So we have enhanced the previous script to collect statistics per
95program name. The output might be large so we'll redirect it to a file.
96
97> ./kmalloc2.stp > out
98
99(runs for 10 seconds)
100
101> more out
102
103
diff --git a/examples/general/graphs.stp b/examples/general/graphs.stp
deleted file mode 100644
index 0c8e3796..00000000
--- a/examples/general/graphs.stp
+++ /dev/null
@@ -1,60 +0,0 @@
1#! stap
2
3# ------------------------------------------------------------------------
4# data collection
5
6# disk I/O stats
7probe begin { qnames["ioblock"] ++; qsq_start ("ioblock") }
8probe ioblock.request { qs_wait ("ioblock") qs_run("ioblock") }
9probe ioblock.end { qs_done ("ioblock") }
10
11# CPU utilization
12probe begin { qnames["cpu"] ++; qsq_start ("cpu") }
13probe scheduler.cpu_on { if (!idle) {qs_wait ("cpu") qs_run ("cpu") }}
14probe scheduler.cpu_off { if (!idle) qs_done ("cpu") }
15
16
17# ------------------------------------------------------------------------
18# utilization history tracking
19
20global N
21probe begin { N = 50 }
22
23global qnames, util, histidx
24
25function qsq_util_reset(q) {
26 u=qsq_utilization (q, 100)
27 qsq_start (q)
28 return u
29}
30
31probe timer.ms(100) { # collect utilization percentages frequently
32 histidx = (histidx + 1) % N # into circular buffer
33 foreach (q in qnames)
34 util[histidx,q] = qsq_util_reset(q)
35}
36
37
38# ------------------------------------------------------------------------
39# general gnuplot graphical report generation
40
41probe timer.ms(1000) {
42 # emit gnuplot command to display recent history
43
44 printf ("set yrange [0:100]\n")
45 printf ("plot ")
46 foreach (q in qnames+)
47 {
48 if (++nq >= 2) printf (", ")
49 printf ("'-' title \"%s\" with lines", q)
50 }
51 printf ("\n")
52
53 foreach (q in qnames+) {
54 for (i = (histidx + 1) % N; i != histidx; i = (i + 1) % N)
55 printf("%d\n", util[i,q])
56 printf ("e\n")
57 }
58
59 printf ("pause 1\n")
60}
diff --git a/examples/general/helloworld.stp b/examples/general/helloworld.stp
deleted file mode 100644
index efe45b79..00000000
--- a/examples/general/helloworld.stp
+++ /dev/null
@@ -1,2 +0,0 @@
1#! /usr/bin/env stap
2probe begin { println("hello world") exit () }
diff --git a/examples/general/para-callgraph.stp b/examples/general/para-callgraph.stp
deleted file mode 100644
index 1afb8837..00000000
--- a/examples/general/para-callgraph.stp
+++ /dev/null
@@ -1,20 +0,0 @@
1function trace(entry_p) {
2 if(tid() in trace)
3 printf("%s%s%s\n",thread_indent(entry_p),
4 (entry_p>0?"->":"<-"),
5 probefunc())
6}
7
8global trace
9probe kernel.function(@1).call {
10 if (execname() == "stapio") next # skip our own helper process
11 trace[tid()] = 1
12 trace(1)
13}
14probe kernel.function(@1).return {
15 trace(-1)
16 delete trace[tid()]
17}
18
19probe kernel.function(@2).call { trace(1) }
20probe kernel.function(@2).return { trace(-1) }
diff --git a/examples/gitweb.php b/examples/gitweb.php
index d65f04b4..f3f96b80 100644
--- a/examples/gitweb.php
+++ b/examples/gitweb.php
@@ -1,10 +1,10 @@
1<?php 1<?php
2$uri = $_SERVER["REQUEST_URI"]; 2$uri = $_SERVER["REQUEST_URI"];
3# $uri1 = $_SERVER["QUERY_STRING"]; 3$uri1 = $_SERVER["QUERY_STRING"];
4# $uri = $_REQUEST["file"]; 4$uri2 = $_REQUEST["file"];
5# $uri = "/systemtap/examples/index.html"; 5# $uri = "/systemtap/examples/index.html";
6$gitfile0 = ereg_replace (".*/examples/", "", $uri); 6$gitfile0 = ereg_replace (".*file=", "", $uri);
7$gitfile1 = "testsuite/systemtap.examples/$gitfile0"; 7$gitfile1 = "testsuite/systemtap.examples/$gitfile0";
8# echo ("$uri0 $uri1 $uri $gitfile0 $gitfile1\n"); 8echo ("$uri $uri1 $uri2 $gitfile0 $gitfile1\n");
9exec ("git --git-dir=/git/systemtap.git show HEAD:$gitfile1"); 9exec ("git --git-dir=/git/systemtap.git show HEAD:$gitfile1");
10?> 10?>
diff --git a/examples/html/systemtap.css b/examples/html/systemtap.css
deleted file mode 100644
index 445d95f4..00000000
--- a/examples/html/systemtap.css
+++ /dev/null
@@ -1,164 +0,0 @@
1body {
2 background-color: #cccccc;
3}
4
5.topnavright {
6 color: #787878;
7 text-align: right;
8 font-family: verdana, Geneva, Arial, Helvetica, sans-serif;
9 font-size: 14px;
10 margin-right: 10px;
11}
12
13.topnavright a:link {
14 text-decoration: none;
15 color: #944E0F;
16}
17
18.topnavright a:visited {
19 text-decoration: none;
20 color: #944E0F;
21}
22
23div.mainbackground {
24 background-color: #ffffff;
25 padding: 17 17 17 17;
26}
27
28div.maintextregion {
29 background-color: #5b5b5b;
30 color: #ffffff;
31}
32
33div.maintextregion h1 {
34 color: #F38019;
35 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
36 font-size: 28px
37}
38
39div.maintextregion h2 {
40 color: #F38019;
41 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
42 margin-bottom: 2px;
43 font-size: 18px;
44 margin-top: 28px;
45}
46
47div.maintextregion h4 {
48 color: #ffffff;
49 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
50 font-weight: bold;
51}
52
53div.maintextregion p {
54 color: #ffffff;
55 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
56 font-size: 14px;
57 line-height: 150%;
58 text-align: justify;
59}
60
61div.maintextregion ul {
62 color: #ffffff;
63 list-style-type: square;
64 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
65 font-size: 14px;
66 line-height: 150%;
67 text-align: justify;
68}
69
70div.maintextregion td ul ul {
71 color: #ffffff;
72 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
73}
74
75div.maintextregion dt {
76 color: #ffffff;
77 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
78 margin-top: 10px;
79}
80
81div.maintextregion pre {
82 color: #ffffff;
83 font-size: 14px;
84}
85
86div.maintextregion td pre {
87 color: #ffffff;
88 font-size: 14px;
89}
90
91div.maintextregion dd {
92 color: #ffffff;
93 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
94 font-size: 14px;
95 line-height: 150%;
96 text-align: justify;
97 margin-left: 10px;
98}
99
100div.maintextregion table {
101 margin-top: 20;
102}
103
104div.maintextregion th {
105 color: #ffffff;
106 background-color: #494949;
107 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
108 text-align: left;
109}
110
111div.maintextregion tr.odd {
112 color: #ffffff;
113 background-color: #393939;
114 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
115}
116
117div.maintextregion tr.even {
118 color: #ffffff;
119 background-color: #4d4d4d;
120 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
121}
122
123div.maintextregion form {
124 color: #ffffff;
125 background-color: #4d4d4d;
126 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
127 border: thin solid #424242;
128 padding: 6;
129}
130
131div.maintextregion dd.left {
132 color: #ffffff;
133 margin-left: 0;
134}
135
136a:link {
137 color: #ff9600;
138 text-decoration: none;
139 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
140}
141
142a:visited {
143 color: #ff9600;
144 text-decoration: none;
145 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
146}
147
148.imgholder {
149 text-align: center;
150 padding: 8;
151}
152.footer a:link {
153 text-decoration: none;
154 color: #944E0F;
155 font-size: 12px;
156 font-weight: bold;
157}
158.footer a:visited {
159 text-decoration: none;
160 color: #944E0F;
161 font-size: 12px;
162 font-weight: bold;
163}
164
diff --git a/examples/html/systemtapcorner.gif b/examples/html/systemtapcorner.gif
deleted file mode 100644
index c44f2c75..00000000
--- a/examples/html/systemtapcorner.gif
+++ /dev/null
Binary files differ
diff --git a/examples/html/systemtaplogo.png b/examples/html/systemtaplogo.png
deleted file mode 100644
index c223babd..00000000
--- a/examples/html/systemtaplogo.png
+++ /dev/null
Binary files differ
diff --git a/examples/index.txt b/examples/index.txt
deleted file mode 100644
index aed6f457..00000000
--- a/examples/index.txt
+++ /dev/null
@@ -1,214 +0,0 @@
1SYSTEMTAP EXAMPLES INDEX
2(see also subsystem-index.txt, keyword-index.txt)
3
4general/graphs.stp - Graphing Disk and CPU Utilization
5subsystems: disk cpu, keywords: disk cpu use graph
6
7 The script tracks the disk and CPU utilization. The resulting output
8 of the script can be piped into gnuplot to generate a graph of disk
9 and CPU USE.
10
11
12general/helloworld.stp - SystemTap "Hello World" Program
13subsystems: none, keywords: simple
14
15 A basic "Hello World" program implemented in SystemTap script. It
16 prints out "hello world" message and then immediately exits.
17
18
19general/para-callgraph.stp - Tracing Calls for Sections of Code
20subsystems: kernel, keywords: trace callgraph
21
22 The script takes two arguments: the first argument is the function to
23 starts/stops the per thread call graph traces and the second argument
24 is the list of functions to generate trace information on. The script
25 prints out a timestap for the thread, the function name and pid,
26 followed by entry or exit symboly and function name.
27
28
29io/disktop.stp - Summarize Disk Read/Write Traffic
30subsystems: disk, keywords: disk
31
32 Get the status of reading/writing disk every 5 seconds, output top
33 ten entries during that period.
34
35
36io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
37subsystems: io, keywords: io backtrace
38
39 When a reschedule occurs during an AIO io_submit call, accumulate the
40 traceback in a histogram. When the script exits prints out a sorted
41 list from most common to least common backtrace.
42
43
44io/iotime.stp - Trace Time Spent in Read and Write for Files
45subsystems: syscall, keywords: syscall read write time io
46
47 The script watches each open, close, read, and write syscalls on the
48 system. For each file the scripts observes opened it accumulates the
49 amount of wall clock time spend in read and write operations and the
50 number of bytes read and written. When a file is closed the script
51 prints out a pair of lines for the file. Both lines begin with a
52 timestamp in microseconds, the PID number, and the executable name in
53 parenthesese. The first line with the "access" keyword lists the file
54 name, the attempted number of bytes for the read and write
55 operations. The second line with the "iotime" keyword list the file
56 name and the number of microseconds accumulated in the read and write
57 syscalls.
58
59
60io/iotop.stp - Periodically Print I/O Activity by Process Name
61subsystems: io, keywords: io
62
63 Every five seconds print out the top ten executables generating I/O
64 traffic during that interval sorted in descending order.
65
66
67io/traceio.stp - Track Cumulative I/O Activity by Process Name
68subsystems: io, keywords: io
69
70 Every second print out the top ten executables sorted in descending
71 order based on cumulative I/O traffic observed.
72
73
74io/traceio2.stp - Watch I/O Activity on a Particular Device
75subsystems: io, keywords: io
76
77 Print out the executable name and process number as reads and writes
78 to the specified device occur.
79
80
81network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
82subsystems: network, keywords: network traffic per-process
83
84 Every five seconds the nettop.stp script prints out a list of
85 processed (PID and command) with the number of packets sent/received
86 and the amount of data sent/received by the process during that
87 interval.
88
89
90network/socket-trace.stp - Trace Functions called in Network Socket Code
91subsystems: network, keywords: network socket
92
93 The script instrument each of the functions inn the Linux kernel's
94 net/socket.c file. The script prints out trace. The first element of
95 a line is time delta in microseconds from the previous entry. This
96 is followed by the command name and the PID. The "->" and "<-"
97 indicates function entry and function exit, respectively. The last
98 element of the line is the function name.
99
100
101process/futexes.stp - System-Wide Futex Contention
102subsystems: locking, keywords: syscall locking futex
103
104 The script watches the futex syscall on the system. On exit the
105 futexes address, the number of contentions, and the average time for
106 each contention on the futex are printed from lowest pid number to
107 highest.
108
109
110process/pf2.stp - Profile kernel functions
111subsystems: kernel, keywords: profiling
112
113 The pf2.stp script sets up time-based sampling. Every five seconds it
114 prints out a sorted list with the top ten kernel functions with
115 samples.
116
117
118process/sig_by_pid.stp - Signal Counts by Process ID
119subsystems: signals, keywords: signals
120
121 Print signal counts by process ID in descending order.
122
123
124process/sig_by_proc.stp - Signal Counts by Process Name
125subsystems: signals, keywords: signals
126
127 Print signal counts by process name in descending order.
128
129
130process/sigkill.stp - Track SIGKILL Signals
131subsystems: signals, keywords: signals
132
133 The script traces any SIGKILL signals. When that SIGKILL signal is
134 sent to a process, the script prints out the signal name, the
135 desination executable and process ID, the executable name user ID
136 that sent the signal.
137
138
139process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
140subsystems: signals, keywords: signals
141
142 The script watches for a particular signal sent to a specific
143 process. When that signal is sent to the specified process, the
144 script prints out the PID and executable of the process sending the
145 signal, the PID and executable name of the process receiving the
146 signal, and the signal number and name.
147
148
149process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
150subsystems: scheduler, keywords: io scheduler
151
152 The script monitor time threads spend waiting for IO operations (in
153 "D" state) in the wait_for_completion function. If a thread spends
154 over 10ms wall-clock time waiting, information is printed out
155 describing the thread number and executable name. When slow the
156 wait_for_completion function complete, backtraces for the long
157 duration calls are printed out.
158
159
160process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls
161subsystems: syscall, keywords: syscall sleep
162
163 The script watches each nanosleep syscall on the system. At the end
164 of each nanosleep syscall the script prints out a line with a
165 timestamp in microseconds, the pid, the executable name in
166 paretheses, the "nanosleep:" key, and the duration of the sleep in
167 microseconds.
168
169
170process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
171subsystems: syscall, keywords: syscall
172
173 The script watches all syscall on the system. On exit the script
174 prints a list showing the number of systemcalls executed by each PID
175 ordered from greatest to least number of syscalls.
176
177
178process/syscalls_by_proc.stp - System-Wide Count of Syscalls by Executable
179subsystems: syscall, keywords: syscall
180
181 The script watches all syscall on the system. On exit the script
182 prints a list showing the number of systemcalls executed by each
183 executable ordered from greates to least number of syscalls.
184
185
186process/wait4time.stp - Trace Time Spent in wait4 Syscalls
187subsystems: syscall, keywords: syscall wait4
188
189 The script watches each wait4 syscall on the system. At the end of
190 each wait4 syscall the script prints out a line with a timestamp in
191 microseconds, the pid, the executable name in paretheses, the
192 "wait4:" key, the duration of the wait and the PID that the wait4 was
193 waiting for. If the waited for PID is not specified , it is "-1".
194
195
196profiling/functioncallcount.stp - Count Times Functions Called
197subsystems: kernel, keywords: profiling functions
198
199 The functioncallcount.stp script takes one argument, a list of
200 functions to probe. The script will run and count the number of times
201 that each of the functions on the list is called. On exit the script
202 will print a sorted list from most frequently to least frequently
203 called function.
204
205
206profiling/thread-times.stp - Profile kernel functions
207subsystems: kernel, keywords: profiling
208
209 The thread-times.stp script sets up time-based sampling. Every five
210 seconds it prints out a sorted list with the top twenty processes
211 with samples broken down into percentage total time spent in
212 user-space and kernel-space.
213
214
diff --git a/examples/io/disktop.stp b/examples/io/disktop.stp
deleted file mode 100644
index 2637d735..00000000
--- a/examples/io/disktop.stp
+++ /dev/null
@@ -1,69 +0,0 @@
1#!/usr/bin/env stap
2#
3# Copyright (C) 2007 Oracle Corp.
4#
5# Get the status of reading/writing disk every 5 seconds, output top ten entries
6#
7# This is free software,GNU General Public License (GPL); either version 2, or (at your option) any
8# later version.
9#
10# Usage:
11# ./disktop.stp
12#
13
14global io_stat,device
15global read_bytes,write_bytes
16
17probe kernel.function("vfs_read").return {
18 if ($return>0) {
19 dev = __file_dev($file)
20 devname = __find_bdevname(dev,__file_bdev($file))
21
22 if (devname!="N/A") {/*skip read from cache*/
23 io_stat[pid(),execname(),uid(),ppid(),"R"] += $return
24 device[pid(),execname(),uid(),ppid(),"R"] = devname
25 read_bytes += $return
26 }
27 }
28}
29
30probe kernel.function("vfs_write").return {
31 if ($return>0) {
32 dev = __file_dev($file)
33 devname = __find_bdevname(dev,__file_bdev($file))
34
35 if (devname!="N/A") { /*skip update cache*/
36 io_stat[pid(),execname(),uid(),ppid(),"W"] += $return
37 device[pid(),execname(),uid(),ppid(),"W"] = devname
38 write_bytes += $return
39 }
40 }
41}
42
43probe timer.ms(5000) {
44 /* skip non-read/write disk */
45 if (read_bytes+write_bytes) {
46
47 printf("\n%-25s, %-8s%4dKb/sec, %-7s%6dKb, %-7s%6dKb\n\n",ctime(gettimeofday_s()),"Average:",
48 ((read_bytes+write_bytes)/1024)/5,"Read:",read_bytes/1024,"Write:",write_bytes/1024)
49
50 /* print header */
51 printf("%8s %8s %8s %25s %8s %4s %12s\n","UID","PID","PPID","CMD","DEVICE","T","BYTES")
52 }
53 /* print top ten I/O */
54 foreach ([process,cmd,userid,parent,action] in io_stat- limit 10)
55 printf("%8d %8d %8d %25s %8s %4s %12d\n",userid,process,parent,cmd,device[process,cmd,userid,parent,action],action,io_stat[process,cmd,userid,parent,action])
56
57 /* clear data */
58 delete io_stat
59 delete device
60 read_bytes = 0
61 write_bytes = 0
62}
63
64probe end{
65 delete io_stat
66 delete device
67 delete read_bytes
68 delete write_bytes
69}
diff --git a/examples/io/io_submit.stp b/examples/io/io_submit.stp
deleted file mode 100644
index 735dd6f9..00000000
--- a/examples/io/io_submit.stp
+++ /dev/null
@@ -1,71 +0,0 @@
1#!/bin/env stap
2#
3# Copyright (C) 2007 Oracle Corp. Chris Mason <chris.mason@oracle.com>
4#
5# This was implemented to find the most common causes of schedule during
6# the AIO io_submit call. It does this by recording which pids are inside
7# AIO, and recording the current stack trace if one of those pids is
8# inside schedule.
9# When the probe exits, it prints out the 30 most common call stacks for
10# schedule().
11#
12# This file is free software. You can redistribute it and/or modify it under
13# the terms of the GNU General Public License (GPL); either version 2, or (at
14# your option) any later version.
15
16global in_iosubmit
17global traces
18
19/*
20 * add a probe to sys_io_submit, on entry, record in the in_iosubmit
21 * hash table that this proc is in io_submit
22 */
23probe syscall.io_submit {
24 in_iosubmit[tid()] = 1
25}
26
27/*
28 * when we return from sys_io_submit, record that we're no longer there
29 */
30probe syscall.io_submit.return {
31 /* this assumes a given proc will do lots of io_submit calls, and
32 * so doesn't do the more expensive "delete in_iosubmit[p]". If
33 * there are lots of procs doing small number of io_submit calls,
34 * the hash may grow pretty big, so using delete may be better
35 */
36 in_iosubmit[tid()] = 0
37}
38
39/*
40 * every time we call schedule, check to see if we started off in
41 * io_submit. If so, record our backtrace into the traces histogram
42 */
43probe kernel.function("schedule") {
44 if (tid() in in_iosubmit) {
45 traces[backtrace()]++
46
47 /*
48 * change this to if (1) if you want a backtrace every time
49 * you go into schedule from io_submit. Unfortunately, the traces
50 * saved into the traces histogram above are truncated to just a
51 * few lines. so the only way to see the full trace is via the
52 * more verbose print_backtrace() right here.
53 */
54 if (0) {
55 printf("schedule in io_submit!\n")
56 print_backtrace()
57 }
58 }
59}
60
61/*
62 * when stap is done (via ctrl-c) go through the record of all the
63 * trace paths and print the 30 most common.
64 */
65probe end {
66 foreach (stack in traces- limit 30) {
67 printf("%d:", traces[stack])
68 print_stack(stack);
69 }
70}
71
diff --git a/examples/io/iotime.stp b/examples/io/iotime.stp
deleted file mode 100644
index 4fbd6b6e..00000000
--- a/examples/io/iotime.stp
+++ /dev/null
@@ -1,113 +0,0 @@
1#! /usr/bin/env stap
2
3/*
4 * Copyright (C) 2006-2007 Red Hat Inc.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * You should have received a copy of the GNU General Public License
11 * along with this program; if not, write to the Free Software Foundation,
12 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13 *
14 * Print out the amount of time spent in the read and write systemcall
15 * when a process closes each file is closed. Note that the systemtap
16 * script needs to be running before the open operations occur for
17 * the script to record data.
18 *
19 * This script could be used to to find out which files are slow to load
20 * on a machine. e.g.
21 *
22 * stap iotime.stp -c 'firefox'
23 *
24 * Output format is:
25 * timestamp pid (executabable) info_type path ...
26 *
27 * 200283135 2573 (cupsd) access /etc/printcap read: 0 write: 7063
28 * 200283143 2573 (cupsd) iotime /etc/printcap time: 69
29 *
30 */
31
32global start
33global entry_io
34global fd_io
35global time_io
36
37function timestamp:long() {
38 return gettimeofday_us() - start
39}
40
41function proc:string() {
42 return sprintf("%d (%s)", pid(), execname())
43}
44
45probe begin {
46 start = gettimeofday_us()
47}
48
49global filenames
50global filehandles
51global fileread
52global filewrite
53
54probe syscall.open {
55 filenames[pid()] = user_string($filename)
56}
57
58probe syscall.open.return {
59 if ($return != -1) {
60 filehandles[pid(), $return] = filenames[pid()]
61 fileread[pid(), $return] = 0
62 filewrite[pid(), $return] = 0
63 } else {
64 printf("%d %s access %s fail\n", timestamp(), proc(), filenames[pid()])
65 }
66 delete filenames[pid()]
67}
68
69probe syscall.read {
70 if ($count > 0) {
71 fileread[pid(), $fd] += $count
72 }
73 t = gettimeofday_us(); p = pid()
74 entry_io[p] = t
75 fd_io[p] = $fd
76}
77
78probe syscall.read.return {
79 t = gettimeofday_us(); p = pid()
80 fd = fd_io[p]
81 time_io[p,fd] <<< t - entry_io[p]
82}
83
84probe syscall.write {
85 if ($count > 0) {
86 filewrite[pid(), $fd] += $count
87 }
88 t = gettimeofday_us(); p = pid()
89 entry_io[p] = t
90 fd_io[p] = $fd
91}
92
93probe syscall.write.return {
94 t = gettimeofday_us(); p = pid()
95 fd = fd_io[p]
96 time_io[p,fd] <<< t - entry_io[p]
97}
98
99probe syscall.close {
100 if (filehandles[pid(), $fd] != "") {
101 printf("%d %s access %s read: %d write: %d\n", timestamp(), proc(),
102 filehandles[pid(), $fd], fileread[pid(), $fd], filewrite[pid(), $fd])
103 if (@count(time_io[pid(), $fd]))
104 printf("%d %s iotime %s time: %d\n", timestamp(), proc(),
105 filehandles[pid(), $fd], @sum(time_io[pid(), $fd]))
106 }
107 delete fileread[pid(), $fd]
108 delete filewrite[pid(), $fd]
109 delete filehandles[pid(), $fd]
110 delete fd_io[pid()]
111 delete entry_io[pid()]
112 delete time_io[pid(),$fd]
113}
diff --git a/examples/io/iotop.stp b/examples/io/iotop.stp
deleted file mode 100644
index 6050343c..00000000
--- a/examples/io/iotop.stp
+++ /dev/null
@@ -1,25 +0,0 @@
1global reads, writes, total_io
2
3probe kernel.function("vfs_read") {
4 reads[execname()] += $count
5}
6
7probe kernel.function("vfs_write") {
8 writes[execname()] += $count
9}
10
11# print top 10 IO processes every 5 seconds
12probe timer.s(5) {
13 foreach (name in writes)
14 total_io[name] += writes[name]
15 foreach (name in reads)
16 total_io[name] += reads[name]
17 printf ("%16s\t%10s\t%10s\n", "Process", "KB Read", "KB Written")
18 foreach (name in total_io- limit 10)
19 printf("%16s\t%10d\t%10d\n", name,
20 reads[name]/1024, writes[name]/1024)
21 delete reads
22 delete writes
23 delete total_io
24 print("\n")
25}
diff --git a/examples/io/traceio.stp b/examples/io/traceio.stp
deleted file mode 100644
index d3757c23..00000000
--- a/examples/io/traceio.stp
+++ /dev/null
@@ -1,32 +0,0 @@
1#!/usr/bin/env stap
2# traceio.stp
3# Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9
10global reads, writes, total_io
11
12probe kernel.function("vfs_read").return {
13 reads[execname()] += $return
14}
15
16probe kernel.function("vfs_write").return {
17 writes[execname()] += $return
18}
19
20probe timer.s(1) {
21 foreach (p in reads)
22 total_io[p] += reads[p]
23 foreach (p in writes)
24 total_io[p] += writes[p]
25 foreach(p in total_io- limit 10)
26 printf("%15s r: %8d KiB w: %8d KiB\n",
27 p, reads[p]/1024,
28 writes[p]/1024)
29 printf("\n")
30 # Note we don't zero out reads, writes and total_io,
31 # so the values are cumulative since the script started.
32}
diff --git a/examples/io/traceio2.stp b/examples/io/traceio2.stp
deleted file mode 100644
index 656c38b3..00000000
--- a/examples/io/traceio2.stp
+++ /dev/null
@@ -1,20 +0,0 @@
1global device_of_interest
2
3probe begin {
4 /* The following is not the most efficient way to do this.
5 One could directly put the result of usrdev2kerndev()
6 into device_of_interest. However, want to test out
7 the other device functions */
8 dev = usrdev2kerndev($1)
9 device_of_interest = MKDEV(MAJOR(dev), MINOR(dev))
10}
11
12probe kernel.function ("vfs_write"),
13 kernel.function ("vfs_read")
14{
15 dev_nr = $file->f_path->dentry->d_inode->i_sb->s_dev
16
17 if (dev_nr == device_of_interest)
18 printf ("%s(%d) %s 0x%x\n",
19 execname(), pid(), probefunc(), dev_nr)
20}
diff --git a/examples/keyword-index.txt b/examples/keyword-index.txt
deleted file mode 100644
index d2e20148..00000000
--- a/examples/keyword-index.txt
+++ /dev/null
@@ -1,458 +0,0 @@
1SYSTEMTAP EXAMPLES INDEX BY KEYWORD
2(see also index.txt, subsystem-index.txt)
3
4= BACKTRACE =
5
6io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
7subsystems: io, keywords: io backtrace
8
9 When a reschedule occurs during an AIO io_submit call, accumulate the
10 traceback in a histogram. When the script exits prints out a sorted
11 list from most common to least common backtrace.
12
13
14= CALLGRAPH =
15
16general/para-callgraph.stp - Tracing Calls for Sections of Code
17subsystems: kernel, keywords: trace callgraph
18
19 The script takes two arguments: the first argument is the function to
20 starts/stops the per thread call graph traces and the second argument
21 is the list of functions to generate trace information on. The script
22 prints out a timestap for the thread, the function name and pid,
23 followed by entry or exit symboly and function name.
24
25
26= CPU =
27
28general/graphs.stp - Graphing Disk and CPU Utilization
29subsystems: disk cpu, keywords: disk cpu use graph
30
31 The script tracks the disk and CPU utilization. The resulting output
32 of the script can be piped into gnuplot to generate a graph of disk
33 and CPU USE.
34
35
36= DISK =
37
38general/graphs.stp - Graphing Disk and CPU Utilization
39subsystems: disk cpu, keywords: disk cpu use graph
40
41 The script tracks the disk and CPU utilization. The resulting output
42 of the script can be piped into gnuplot to generate a graph of disk
43 and CPU USE.
44
45
46io/disktop.stp - Summarize Disk Read/Write Traffic
47subsystems: disk, keywords: disk
48
49 Get the status of reading/writing disk every 5 seconds, output top
50 ten entries during that period.
51
52
53= FUNCTIONS =
54
55profiling/functioncallcount.stp - Count Times Functions Called
56subsystems: kernel, keywords: profiling functions
57
58 The functioncallcount.stp script takes one argument, a list of
59 functions to probe. The script will run and count the number of times
60 that each of the functions on the list is called. On exit the script
61 will print a sorted list from most frequently to least frequently
62 called function.
63
64
65= FUTEX =
66
67process/futexes.stp - System-Wide Futex Contention
68subsystems: locking, keywords: syscall locking futex
69
70 The script watches the futex syscall on the system. On exit the
71 futexes address, the number of contentions, and the average time for
72 each contention on the futex are printed from lowest pid number to
73 highest.
74
75
76= GRAPH =
77
78general/graphs.stp - Graphing Disk and CPU Utilization
79subsystems: disk cpu, keywords: disk cpu use graph
80
81 The script tracks the disk and CPU utilization. The resulting output
82 of the script can be piped into gnuplot to generate a graph of disk
83 and CPU USE.
84
85
86= IO =
87
88io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
89subsystems: io, keywords: io backtrace
90
91 When a reschedule occurs during an AIO io_submit call, accumulate the
92 traceback in a histogram. When the script exits prints out a sorted
93 list from most common to least common backtrace.
94
95
96io/iotime.stp - Trace Time Spent in Read and Write for Files
97subsystems: syscall, keywords: syscall read write time io
98
99 The script watches each open, close, read, and write syscalls on the
100 system. For each file the scripts observes opened it accumulates the
101 amount of wall clock time spend in read and write operations and the
102 number of bytes read and written. When a file is closed the script
103 prints out a pair of lines for the file. Both lines begin with a
104 timestamp in microseconds, the PID number, and the executable name in
105 parenthesese. The first line with the "access" keyword lists the file
106 name, the attempted number of bytes for the read and write
107 operations. The second line with the "iotime" keyword list the file
108 name and the number of microseconds accumulated in the read and write
109 syscalls.
110
111
112io/iotop.stp - Periodically Print I/O Activity by Process Name
113subsystems: io, keywords: io
114
115 Every five seconds print out the top ten executables generating I/O
116 traffic during that interval sorted in descending order.
117
118
119io/traceio.stp - Track Cumulative I/O Activity by Process Name
120subsystems: io, keywords: io
121
122 Every second print out the top ten executables sorted in descending
123 order based on cumulative I/O traffic observed.
124
125
126io/traceio2.stp - Watch I/O Activity on a Particular Device
127subsystems: io, keywords: io
128
129 Print out the executable name and process number as reads and writes
130 to the specified device occur.
131
132
133process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
134subsystems: scheduler, keywords: io scheduler
135
136 The script monitor time threads spend waiting for IO operations (in
137 "D" state) in the wait_for_completion function. If a thread spends
138 over 10ms wall-clock time waiting, information is printed out
139 describing the thread number and executable name. When slow the
140 wait_for_completion function complete, backtraces for the long
141 duration calls are printed out.
142
143
144= LOCKING =
145
146process/futexes.stp - System-Wide Futex Contention
147subsystems: locking, keywords: syscall locking futex
148
149 The script watches the futex syscall on the system. On exit the
150 futexes address, the number of contentions, and the average time for
151 each contention on the futex are printed from lowest pid number to
152 highest.
153
154
155= NETWORK =
156
157network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
158subsystems: network, keywords: network traffic per-process
159
160 Every five seconds the nettop.stp script prints out a list of
161 processed (PID and command) with the number of packets sent/received
162 and the amount of data sent/received by the process during that
163 interval.
164
165
166network/socket-trace.stp - Trace Functions called in Network Socket Code
167subsystems: network, keywords: network socket
168
169 The script instrument each of the functions inn the Linux kernel's
170 net/socket.c file. The script prints out trace. The first element of
171 a line is time delta in microseconds from the previous entry. This
172 is followed by the command name and the PID. The "->" and "<-"
173 indicates function entry and function exit, respectively. The last
174 element of the line is the function name.
175
176
177= PER-PROCESS =
178
179network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
180subsystems: network, keywords: network traffic per-process
181
182 Every five seconds the nettop.stp script prints out a list of
183 processed (PID and command) with the number of packets sent/received
184 and the amount of data sent/received by the process during that
185 interval.
186
187
188= PROFILING =
189
190process/pf2.stp - Profile kernel functions
191subsystems: kernel, keywords: profiling
192
193 The pf2.stp script sets up time-based sampling. Every five seconds it
194 prints out a sorted list with the top ten kernel functions with
195 samples.
196
197
198profiling/functioncallcount.stp - Count Times Functions Called
199subsystems: kernel, keywords: profiling functions
200
201 The functioncallcount.stp script takes one argument, a list of
202 functions to probe. The script will run and count the number of times
203 that each of the functions on the list is called. On exit the script
204 will print a sorted list from most frequently to least frequently
205 called function.
206
207
208profiling/thread-times.stp - Profile kernel functions
209subsystems: kernel, keywords: profiling
210
211 The thread-times.stp script sets up time-based sampling. Every five
212 seconds it prints out a sorted list with the top twenty processes
213 with samples broken down into percentage total time spent in
214 user-space and kernel-space.
215
216
217= READ =
218
219io/iotime.stp - Trace Time Spent in Read and Write for Files
220subsystems: syscall, keywords: syscall read write time io
221
222 The script watches each open, close, read, and write syscalls on the
223 system. For each file the scripts observes opened it accumulates the
224 amount of wall clock time spend in read and write operations and the
225 number of bytes read and written. When a file is closed the script
226 prints out a pair of lines for the file. Both lines begin with a
227 timestamp in microseconds, the PID number, and the executable name in
228 parenthesese. The first line with the "access" keyword lists the file
229 name, the attempted number of bytes for the read and write
230 operations. The second line with the "iotime" keyword list the file
231 name and the number of microseconds accumulated in the read and write
232 syscalls.
233
234
235= SCHEDULER =
236
237process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
238subsystems: scheduler, keywords: io scheduler
239
240 The script monitor time threads spend waiting for IO operations (in
241 "D" state) in the wait_for_completion function. If a thread spends
242 over 10ms wall-clock time waiting, information is printed out
243 describing the thread number and executable name. When slow the
244 wait_for_completion function complete, backtraces for the long
245 duration calls are printed out.
246
247
248= SIGNALS =
249
250process/sig_by_pid.stp - Signal Counts by Process ID
251subsystems: signals, keywords: signals
252
253 Print signal counts by process ID in descending order.
254
255
256process/sig_by_proc.stp - Signal Counts by Process Name
257subsystems: signals, keywords: signals
258
259 Print signal counts by process name in descending order.
260
261
262process/sigkill.stp - Track SIGKILL Signals
263subsystems: signals, keywords: signals
264
265 The script traces any SIGKILL signals. When that SIGKILL signal is
266 sent to a process, the script prints out the signal name, the
267 desination executable and process ID, the executable name user ID
268 that sent the signal.
269
270
271process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
272subsystems: signals, keywords: signals
273
274 The script watches for a particular signal sent to a specific
275 process. When that signal is sent to the specified process, the
276 script prints out the PID and executable of the process sending the
277 signal, the PID and executable name of the process receiving the
278 signal, and the signal number and name.
279
280
281= SIMPLE =
282
283general/helloworld.stp - SystemTap "Hello World" Program
284subsystems: none, keywords: simple
285
286 A basic "Hello World" program implemented in SystemTap script. It
287 prints out "hello world" message and then immediately exits.
288
289
290= SLEEP =
291
292process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls
293subsystems: syscall, keywords: syscall sleep
294
295 The script watches each nanosleep syscall on the system. At the end
296 of each nanosleep syscall the script prints out a line with a
297 timestamp in microseconds, the pid, the executable name in
298 paretheses, the "nanosleep:" key, and the duration of the sleep in
299 microseconds.
300
301
302= SOCKET =
303
304network/socket-trace.stp - Trace Functions called in Network Socket Code
305subsystems: network, keywords: network socket
306
307 The script instrument each of the functions inn the Linux kernel's
308 net/socket.c file. The script prints out trace. The first element of
309 a line is time delta in microseconds from the previous entry. This
310 is followed by the command name and the PID. The "->" and "<-"
311 indicates function entry and function exit, respectively. The last
312 element of the line is the function name.
313
314
315= SYSCALL =
316
317io/iotime.stp - Trace Time Spent in Read and Write for Files
318subsystems: syscall, keywords: syscall read write time io
319
320 The script watches each open, close, read, and write syscalls on the
321 system. For each file the scripts observes opened it accumulates the
322 amount of wall clock time spend in read and write operations and the
323 number of bytes read and written. When a file is closed the script
324 prints out a pair of lines for the file. Both lines begin with a
325 timestamp in microseconds, the PID number, and the executable name in
326 parenthesese. The first line with the "access" keyword lists the file
327 name, the attempted number of bytes for the read and write
328 operations. The second line with the "iotime" keyword list the file
329 name and the number of microseconds accumulated in the read and write
330 syscalls.
331
332
333process/futexes.stp - System-Wide Futex Contention
334subsystems: locking, keywords: syscall locking futex
335
336 The script watches the futex syscall on the system. On exit the
337 futexes address, the number of contentions, and the average time for
338 each contention on the futex are printed from lowest pid number to
339 highest.
340
341
342process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls
343subsystems: syscall, keywords: syscall sleep
344
345 The script watches each nanosleep syscall on the system. At the end
346 of each nanosleep syscall the script prints out a line with a
347 timestamp in microseconds, the pid, the executable name in
348 paretheses, the "nanosleep:" key, and the duration of the sleep in
349 microseconds.
350
351
352process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
353subsystems: syscall, keywords: syscall
354
355 The script watches all syscall on the system. On exit the script
356 prints a list showing the number of systemcalls executed by each PID
357 ordered from greatest to least number of syscalls.
358
359
360process/syscalls_by_proc.stp - System-Wide Count of Syscalls by Executable
361subsystems: syscall, keywords: syscall
362
363 The script watches all syscall on the system. On exit the script
364 prints a list showing the number of systemcalls executed by each
365 executable ordered from greates to least number of syscalls.
366
367
368process/wait4time.stp - Trace Time Spent in wait4 Syscalls
369subsystems: syscall, keywords: syscall wait4
370
371 The script watches each wait4 syscall on the system. At the end of
372 each wait4 syscall the script prints out a line with a timestamp in
373 microseconds, the pid, the executable name in paretheses, the
374 "wait4:" key, the duration of the wait and the PID that the wait4 was
375 waiting for. If the waited for PID is not specified , it is "-1".
376
377
378= TIME =
379
380io/iotime.stp - Trace Time Spent in Read and Write for Files
381subsystems: syscall, keywords: syscall read write time io
382
383 The script watches each open, close, read, and write syscalls on the
384 system. For each file the scripts observes opened it accumulates the
385 amount of wall clock time spend in read and write operations and the
386 number of bytes read and written. When a file is closed the script
387 prints out a pair of lines for the file. Both lines begin with a
388 timestamp in microseconds, the PID number, and the executable name in
389 parenthesese. The first line with the "access" keyword lists the file
390 name, the attempted number of bytes for the read and write
391 operations. The second line with the "iotime" keyword list the file
392 name and the number of microseconds accumulated in the read and write
393 syscalls.
394
395
396= TRACE =
397
398general/para-callgraph.stp - Tracing Calls for Sections of Code
399subsystems: kernel, keywords: trace callgraph
400
401 The script takes two arguments: the first argument is the function to
402 starts/stops the per thread call graph traces and the second argument
403 is the list of functions to generate trace information on. The script
404 prints out a timestap for the thread, the function name and pid,
405 followed by entry or exit symboly and function name.
406
407
408= TRAFFIC =
409
410network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
411subsystems: network, keywords: network traffic per-process
412
413 Every five seconds the nettop.stp script prints out a list of
414 processed (PID and command) with the number of packets sent/received
415 and the amount of data sent/received by the process during that
416 interval.
417
418
419= USE =
420
421general/graphs.stp - Graphing Disk and CPU Utilization
422subsystems: disk cpu, keywords: disk cpu use graph
423
424 The script tracks the disk and CPU utilization. The resulting output
425 of the script can be piped into gnuplot to generate a graph of disk
426 and CPU USE.
427
428
429= WAIT4 =
430
431process/wait4time.stp - Trace Time Spent in wait4 Syscalls
432subsystems: syscall, keywords: syscall wait4
433
434 The script watches each wait4 syscall on the system. At the end of
435 each wait4 syscall the script prints out a line with a timestamp in
436 microseconds, the pid, the executable name in paretheses, the
437 "wait4:" key, the duration of the wait and the PID that the wait4 was
438 waiting for. If the waited for PID is not specified , it is "-1".
439
440
441= WRITE =
442
443io/iotime.stp - Trace Time Spent in Read and Write for Files
444subsystems: syscall, keywords: syscall read write time io
445
446 The script watches each open, close, read, and write syscalls on the
447 system. For each file the scripts observes opened it accumulates the
448 amount of wall clock time spend in read and write operations and the
449 number of bytes read and written. When a file is closed the script
450 prints out a pair of lines for the file. Both lines begin with a
451 timestamp in microseconds, the PID number, and the executable name in
452 parenthesese. The first line with the "access" keyword lists the file
453 name, the attempted number of bytes for the read and write
454 operations. The second line with the "iotime" keyword list the file
455 name and the number of microseconds accumulated in the read and write
456 syscalls.
457
458
diff --git a/examples/network/nettop.stp b/examples/network/nettop.stp
deleted file mode 100644
index 96db413a..00000000
--- a/examples/network/nettop.stp
+++ /dev/null
@@ -1,42 +0,0 @@
1#! /usr/bin/env stap
2
3global ifxmit, ifrecv
4
5probe netdev.transmit
6{
7 ifxmit[pid(), dev_name, execname(), uid()] <<< length
8}
9
10probe netdev.receive
11{
12 ifrecv[pid(), dev_name, execname(), uid()] <<< length
13}
14
15
16function print_activity()
17{
18 printf("%5s %5s %-7s %7s %7s %7s %7s %-15s\n",
19 "PID", "UID", "DEV", "XMIT_PK", "RECV_PK",
20 "XMIT_KB", "RECV_KB", "COMMAND")
21
22 foreach ([pid, dev, exec, uid] in ifrecv-) {
23 n_xmit = @count(ifxmit[pid, dev, exec, uid])
24 n_recv = @count(ifrecv[pid, dev, exec, uid])
25 printf("%5d %5d %-7s %7d %7d %7d %7d %-15s\n",
26 pid, uid, dev, n_xmit, n_recv,
27 n_xmit ? @sum(ifxmit[pid, dev, exec, uid])/1024 : 0,
28 n_recv ? @sum(ifrecv[pid, dev, exec, uid])/1024 : 0,
29 exec)
30 }
31
32 print("\n")
33
34 delete ifxmit
35 delete ifrecv
36}
37
38probe timer.ms(5000), end, error
39{
40 print_activity()
41}
42
diff --git a/examples/network/socket-trace.stp b/examples/network/socket-trace.stp
deleted file mode 100644
index 13ab8e06..00000000
--- a/examples/network/socket-trace.stp
+++ /dev/null
@@ -1,8 +0,0 @@
1#! /usr/bin/env stap
2
3probe kernel.function("*@net/socket.c").call {
4 printf ("%s -> %s\n", thread_indent(1), probefunc())
5}
6probe kernel.function("*@net/socket.c").return {
7 printf ("%s <- %s\n", thread_indent(-1), probefunc())
8}
diff --git a/examples/process/futexes.stp b/examples/process/futexes.stp
deleted file mode 100644
index 16c62937..00000000
--- a/examples/process/futexes.stp
+++ /dev/null
@@ -1,36 +0,0 @@
1#! /usr/bin/env stap
2
3# This script tries to identify contended user-space locks by hooking
4# into the futex system call.
5
6global thread_thislock # short
7global thread_blocktime #
8global FUTEX_WAIT = 0 /*, FUTEX_WAKE = 1 */
9
10global lock_waits # long-lived stats on (tid,lock) blockage elapsed time
11global process_names # long-lived pid-to-execname mapping
12
13probe syscall.futex {
14 if (op != FUTEX_WAIT) next # we don't care about originators of WAKE events
15 t = tid ()
16 process_names[pid()] = execname()
17 thread_thislock[t] = $uaddr
18 thread_blocktime[t] = gettimeofday_us()
19}
20
21probe syscall.futex.return {
22 t = tid()
23 ts = thread_blocktime[t]
24 if (ts) {
25 elapsed = gettimeofday_us() - ts
26 lock_waits[pid(), thread_thislock[t]] <<< elapsed
27 delete thread_blocktime[t]
28 delete thread_thislock[t]
29 }
30}
31
32probe end {
33 foreach ([pid+, lock] in lock_waits)
34 printf ("%s[%d] lock %p contended %d times, %d avg us\n",
35 process_names[pid], pid, lock, @count(lock_waits[pid,lock]), @avg(lock_waits[pid,lock]))
36}
diff --git a/examples/process/pf2.stp b/examples/process/pf2.stp
deleted file mode 100644
index a804c3ff..00000000
--- a/examples/process/pf2.stp
+++ /dev/null
@@ -1,16 +0,0 @@
1#! /usr/bin/env stap
2
3global profile, pcount
4probe timer.profile {
5 pcount <<< 1
6 fn = probefunc ()
7 if (fn != "") profile[fn] <<< 1
8}
9probe timer.ms(5000) {
10 printf ("\n--- %d samples recorded:\n", @count(pcount))
11 foreach (f in profile- limit 10) {
12 printf ("%-30s\t%6d\n", f, @count(profile[f]))
13 }
14 delete profile
15 delete pcount
16}
diff --git a/examples/process/sig_by_pid.stp b/examples/process/sig_by_pid.stp
deleted file mode 100644
index 9c1493f5..00000000
--- a/examples/process/sig_by_pid.stp
+++ /dev/null
@@ -1,42 +0,0 @@
1#! /usr/bin/env stap
2
3# Copyright (C) 2006 IBM Corp.
4#
5# This file is part of systemtap, and is free software. You can
6# redistribute it and/or modify it under the terms of the GNU General
7# Public License (GPL); either version 2, or (at your option) any
8# later version.
9
10#
11# Print signal counts by process IDs in descending order.
12#
13
14global sigcnt, pid2name, sig2name
15
16probe begin {
17 print("Collecting data... Type Ctrl-C to exit and display results\n")
18}
19
20probe signal.send
21{
22 snd_pid = pid()
23 rcv_pid = sig_pid
24
25 sigcnt[snd_pid, rcv_pid, sig]++
26
27 if (!(snd_pid in pid2name)) pid2name[snd_pid] = execname()
28 if (!(rcv_pid in pid2name)) pid2name[rcv_pid] = pid_name
29 if (!(sig in sig2name)) sig2name[sig] = sig_name
30}
31
32probe end
33{
34 printf("%-8s %-16s %-5s %-16s %-16s %s\n",
35 "SPID", "SENDER", "RPID", "RECEIVER", "SIGNAME", "COUNT")
36
37 foreach ([snd_pid, rcv_pid, sig_num] in sigcnt-) {
38 printf("%-8d %-16s %-5d %-16s %-16s %d\n",
39 snd_pid, pid2name[snd_pid], rcv_pid, pid2name[rcv_pid],
40 sig2name[sig_num], sigcnt[snd_pid, rcv_pid, sig_num])
41 }
42}
diff --git a/examples/process/sig_by_proc.stp b/examples/process/sig_by_proc.stp
deleted file mode 100644
index ce845aed..00000000
--- a/examples/process/sig_by_proc.stp
+++ /dev/null
@@ -1,36 +0,0 @@
1#! /usr/bin/env stap
2
3# Copyright (C) 2006 IBM Corp.
4#
5# This file is part of systemtap, and is free software. You can
6# redistribute it and/or modify it under the terms of the GNU General
7# Public License (GPL); either version 2, or (at your option) any
8# later version.
9
10#
11# Print signal counts by process name in descending order.
12#
13
14global sigcnt, sig2name
15
16probe begin {
17 print("Collecting data... Type Ctrl-C to exit and display results\n")
18}
19
20probe signal.send
21{
22 sigcnt[execname(), pid_name, sig]++
23
24 if (!(sig in sig2name)) sig2name[sig] = sig_name
25}
26
27probe end
28{
29 printf("%-16s %-16s %-16s %s\n",
30 "SENDER", "RECEIVER", "SIGNAL", "COUNT")
31
32 foreach ([snd_name, rcv_name, sig_num] in sigcnt-)
33 printf("%-16s %-16s %-16s %d\n",
34 snd_name, rcv_name, sig2name[sig_num],
35 sigcnt[snd_name, rcv_name, sig_num])
36}
diff --git a/examples/process/sigkill.stp b/examples/process/sigkill.stp
deleted file mode 100644
index 8f754219..00000000
--- a/examples/process/sigkill.stp
+++ /dev/null
@@ -1,23 +0,0 @@
1#!/usr/bin/env stap
2# sigkill.stp
3# Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9# /usr/share/systemtap/tapset/signal.stp:
10# [...]
11# probe signal.send = _signal.send.*
12# {
13# sig=$sig
14# sig_name = _signal_name($sig)
15# sig_pid = task_pid(task)
16# pid_name = task_execname(task)
17# [...]
18
19probe signal.send {
20 if (sig_name == "SIGKILL")
21 printf("%s was sent to %s (pid:%d) by %s uid:%d\n",
22 sig_name, pid_name, sig_pid, execname(), uid())
23}
diff --git a/examples/process/sleepingBeauties.stp b/examples/process/sleepingBeauties.stp
deleted file mode 100644
index 64c563a3..00000000
--- a/examples/process/sleepingBeauties.stp
+++ /dev/null
@@ -1,58 +0,0 @@
1#! /usr/bin/stap
2
3function time () { return gettimeofday_ms() }
4global time_name = "ms"
5global boredom = 10 # in time units
6global name, back, backtime, bored
7
8/* Note: the order that the probes are listed should not matter.
9 However, the following order for
10 probe kernel.function("wait_for_completion").return and
11 probe kernel.function("wait_for_completion").call
12 avoids have the kretprobe stuff in the backtrace.
13 for more information see:
14 http://sources.redhat.com/bugzilla/show_bug.cgi?id=6436
15*/
16
17
18probe kernel.function("wait_for_completion").return
19{
20 t=tid()
21
22 if ([t] in bored) {
23 patience = time() - backtime[t]
24 printf ("thread %d (%s) bored for %d %s\n",
25 t, name[t], patience, time_name)
26 }
27
28 delete bored[t]
29 delete back[t]
30 delete name[t]
31 delete backtime[t]
32}
33
34
35probe kernel.function("wait_for_completion").call
36{
37 t=tid()
38 back[t]=backtrace()
39 name[t]=execname()
40 backtime[t]=time()
41 delete bored[t]
42}
43
44
45probe timer.profile {
46 foreach (tid+ in back) {
47 if ([tid] in bored) continue
48
49 patience = time() - backtime[tid]
50 if (patience >= boredom) {
51 printf ("thread %d (%s) impatient after %d %s\n",
52 tid, name[tid], patience, time_name)
53 print_stack (back[tid])
54 printf ("\n")
55 bored[tid] = 1 # defer further reports to wakeup
56 }
57 }
58}
diff --git a/examples/process/sleeptime.stp b/examples/process/sleeptime.stp
deleted file mode 100644
index b5729ceb..00000000
--- a/examples/process/sleeptime.stp
+++ /dev/null
@@ -1,62 +0,0 @@
1#! /usr/bin/env stap
2
3/*
4 * Copyright (C) 2006-2007 Red Hat Inc.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * You should have received a copy of the GNU General Public License
11 * along with this program; if not, write to the Free Software Foundation,
12 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13 *
14 * Print out the amount of time spent in the nanosleep and compat_nanosleep
15 * systemcalls. This can help find which processes are waking based on time
16 * rather than some real event than needs to be handled.
17 *
18 * Format is:
19 * 12799538 3389 (xchat) nanosleep: 9547
20 * 12846944 2805 (NetworkManager) nanosleep: 100964
21 * 12947924 2805 (NetworkManager) nanosleep: 100946
22 * 13002925 4757 (sleep) nanosleep: 13000717
23 */
24
25global start
26global entry_nanosleep
27
28function timestamp:long() {
29 return gettimeofday_us() - start
30}
31
32function proc:string() {
33 return sprintf("%d (%s)", pid(), execname())
34}
35
36probe begin {
37 start = gettimeofday_us()
38}
39
40probe syscall.nanosleep {
41 t = gettimeofday_us(); p = pid()
42 entry_nanosleep[p] = t
43}
44
45probe syscall.nanosleep.return {
46 t = gettimeofday_us(); p = pid()
47 elapsed_time = t - entry_nanosleep[p]
48 printf("%d %s nanosleep: %d\n", timestamp(), proc(), elapsed_time)
49 delete entry_nanosleep[p]
50}
51
52probe syscall.compat_nanosleep ? {
53 t = gettimeofday_us(); p = pid()
54 entry_nanosleep[p] = t
55}
56
57probe syscall.compat_nanosleep.return ? {
58 t = gettimeofday_us(); p = pid()
59 elapsed_time = t - entry_nanosleep[p]
60 printf("%d %s compat_nanosleep: %d\n", timestamp(), proc(), elapsed_time)
61 delete entry_nanosleep[p]
62}
diff --git a/examples/process/syscalls_by_pid.stp b/examples/process/syscalls_by_pid.stp
deleted file mode 100644
index 47aa4955..00000000
--- a/examples/process/syscalls_by_pid.stp
+++ /dev/null
@@ -1,28 +0,0 @@
1#! /usr/bin/env stap
2
3# Copyright (C) 2006 IBM Corp.
4#
5# This file is part of systemtap, and is free software. You can
6# redistribute it and/or modify it under the terms of the GNU General
7# Public License (GPL); either version 2, or (at your option) any
8# later version.
9
10#
11# Print the system call count by process ID in descending order.
12#
13
14global syscalls
15
16probe begin {
17 print ("Collecting data... Type Ctrl-C to exit and display results\n")
18}
19
20probe syscall.* {
21 syscalls[pid()]++
22}
23
24probe end {
25 printf ("%-10s %-s\n", "#SysCalls", "PID")
26 foreach (pid in syscalls-)
27 printf("%-10d %-d\n", syscalls[pid], pid)
28}
diff --git a/examples/process/syscalls_by_proc.stp b/examples/process/syscalls_by_proc.stp
deleted file mode 100644
index af7d6932..00000000
--- a/examples/process/syscalls_by_proc.stp
+++ /dev/null
@@ -1,28 +0,0 @@
1#! /usr/bin/env stap
2
3# Copyright (C) 2006 IBM Corp.
4#
5# This file is part of systemtap, and is free software. You can
6# redistribute it and/or modify it under the terms of the GNU General
7# Public License (GPL); either version 2, or (at your option) any
8# later version.
9
10#
11# Print the system call count by process name in descending order.
12#
13
14global syscalls
15
16probe begin {
17 print ("Collecting data... Type Ctrl-C to exit and display results\n")
18}
19
20probe syscall.* {
21 syscalls[execname()]++
22}
23
24probe end {
25 printf ("%-10s %-s\n", "#SysCalls", "Process Name")
26 foreach (proc in syscalls-)
27 printf("%-10d %-s\n", syscalls[proc], proc)
28}
diff --git a/examples/process/wait4time.stp b/examples/process/wait4time.stp
deleted file mode 100644
index ba300ea7..00000000
--- a/examples/process/wait4time.stp
+++ /dev/null
@@ -1,59 +0,0 @@
1#! /usr/bin/env stap
2
3/*
4 * Copyright (C) 2006-2007 Red Hat Inc.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * You should have received a copy of the GNU General Public License
11 * along with this program; if not, write to the Free Software Foundation,
12 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
13 *
14 * Print out the amount of time spent in the read and write systemcall
15 * when a process closes each file is closed. Note that the script needs
16 * to be running before the open operations occur for the script
17 * to record data.
18 *
19 * Format is:
20 * timestamp pid (executabable) wait4: time_us pid
21 *
22 * 155789807 4196 (ssh) wait4: 12 4197
23 * 158270531 3215 (bash) wait4: 5410460 -1
24 * 158270659 3215 (bash) wait4: 9 -1
25 * 158557461 2614 (sendmail) wait4: 27 -1
26 * 158557487 2614 (sendmail) wait4: 5 -1
27 *
28 */
29
30global start
31global entry_wait4
32global wait4_pid
33
34function timestamp:long() {
35 return gettimeofday_us() - start
36}
37
38function proc:string() {
39 return sprintf("%d (%s)", pid(), execname())
40}
41
42probe begin {
43 start = gettimeofday_us()
44}
45
46probe syscall.wait4 {
47 t = gettimeofday_us(); p = pid()
48 entry_wait4[p] = t
49 wait4_pid[p]=pid
50}
51
52probe syscall.wait4.return {
53 t = gettimeofday_us(); p = pid()
54 elapsed_time = t - entry_wait4[p]
55 printf("%d %s wait4: %d %d\n", timestamp(), proc(), elapsed_time,
56 wait4_pid[p])
57 delete entry_wait4[p]
58 delete wait4_pid[p]
59}
diff --git a/examples/profiling/functioncallcount.stp b/examples/profiling/functioncallcount.stp
deleted file mode 100644
index e393b612..00000000
--- a/examples/profiling/functioncallcount.stp
+++ /dev/null
@@ -1,17 +0,0 @@
1# The following line command will probe all the functions
2# in kernel's memory management code:
3#
4# stap functioncallcount.stp "*@mm/*.c"
5
6probe kernel.function(@1) { # probe functions listed on commandline
7 called[probefunc()] <<< 1 # add a count efficiently
8}
9
10global called
11
12probe end {
13 foreach (fn in called-) # Sort by call count (in decreasing order)
14 # (fn+ in called) # Sort by function name
15 printf("%s %d\n", fn, @count(called[fn]))
16 exit()
17}
diff --git a/examples/profiling/thread-times.stp b/examples/profiling/thread-times.stp
deleted file mode 100644
index 1aeb2037..00000000
--- a/examples/profiling/thread-times.stp
+++ /dev/null
@@ -1,32 +0,0 @@
1#! /usr/bin/stap
2
3probe timer.profile {
4 tid=tid()
5 if (!user_mode())
6 kticks[tid] <<< 1
7 else
8 uticks[tid] <<< 1
9 ticks <<< 1
10 tids[tid] <<< 1
11}
12
13global uticks, kticks, ticks
14
15global tids
16
17probe timer.s(5), end {
18 allticks = @count(ticks)
19 printf ("%5s %7s %7s (of %d ticks)\n", "tid", "%user", "%kernel", allticks)
20 foreach (tid in tids- limit 20) {
21 uscaled = @count(uticks[tid])*10000/allticks
22 kscaled = @count(kticks[tid])*10000/allticks
23 printf ("%5d %3d.%02d%% %3d.%02d%%\n",
24 tid, uscaled/100, uscaled%100, kscaled/100, kscaled%100)
25 }
26 printf("\n")
27
28 delete uticks
29 delete kticks
30 delete ticks
31 delete tids
32}
diff --git a/examples/subsystem-index.txt b/examples/subsystem-index.txt
deleted file mode 100644
index 98e75e98..00000000
--- a/examples/subsystem-index.txt
+++ /dev/null
@@ -1,242 +0,0 @@
1SYSTEMTAP EXAMPLES INDEX BY SUBSYSTEM
2(see also index.txt, keyword-index.txt)
3
4= CPU =
5
6general/graphs.stp - Graphing Disk and CPU Utilization
7subsystems: disk cpu, keywords: disk cpu use graph
8
9 The script tracks the disk and CPU utilization. The resulting output
10 of the script can be piped into gnuplot to generate a graph of disk
11 and CPU USE.
12
13
14= DISK =
15
16general/graphs.stp - Graphing Disk and CPU Utilization
17subsystems: disk cpu, keywords: disk cpu use graph
18
19 The script tracks the disk and CPU utilization. The resulting output
20 of the script can be piped into gnuplot to generate a graph of disk
21 and CPU USE.
22
23
24io/disktop.stp - Summarize Disk Read/Write Traffic
25subsystems: disk, keywords: disk
26
27 Get the status of reading/writing disk every 5 seconds, output top
28 ten entries during that period.
29
30
31= IO =
32
33io/io_submit.stp - Tally Reschedule Reason During AIO io_submit Call
34subsystems: io, keywords: io backtrace
35
36 When a reschedule occurs during an AIO io_submit call, accumulate the
37 traceback in a histogram. When the script exits prints out a sorted
38 list from most common to least common backtrace.
39
40
41io/iotop.stp - Periodically Print I/O Activity by Process Name
42subsystems: io, keywords: io
43
44 Every five seconds print out the top ten executables generating I/O
45 traffic during that interval sorted in descending order.
46
47
48io/traceio.stp - Track Cumulative I/O Activity by Process Name
49subsystems: io, keywords: io
50
51 Every second print out the top ten executables sorted in descending
52 order based on cumulative I/O traffic observed.
53
54
55io/traceio2.stp - Watch I/O Activity on a Particular Device
56subsystems: io, keywords: io
57
58 Print out the executable name and process number as reads and writes
59 to the specified device occur.
60
61
62= KERNEL =
63
64general/para-callgraph.stp - Tracing Calls for Sections of Code
65subsystems: kernel, keywords: trace callgraph
66
67 The script takes two arguments: the first argument is the function to
68 starts/stops the per thread call graph traces and the second argument
69 is the list of functions to generate trace information on. The script
70 prints out a timestap for the thread, the function name and pid,
71 followed by entry or exit symboly and function name.
72
73
74process/pf2.stp - Profile kernel functions
75subsystems: kernel, keywords: profiling
76
77 The pf2.stp script sets up time-based sampling. Every five seconds it
78 prints out a sorted list with the top ten kernel functions with
79 samples.
80
81
82profiling/functioncallcount.stp - Count Times Functions Called
83subsystems: kernel, keywords: profiling functions
84
85 The functioncallcount.stp script takes one argument, a list of
86 functions to probe. The script will run and count the number of times
87 that each of the functions on the list is called. On exit the script
88 will print a sorted list from most frequently to least frequently
89 called function.
90
91
92profiling/thread-times.stp - Profile kernel functions
93subsystems: kernel, keywords: profiling
94
95 The thread-times.stp script sets up time-based sampling. Every five
96 seconds it prints out a sorted list with the top twenty processes
97 with samples broken down into percentage total time spent in
98 user-space and kernel-space.
99
100
101= LOCKING =
102
103process/futexes.stp - System-Wide Futex Contention
104subsystems: locking, keywords: syscall locking futex
105
106 The script watches the futex syscall on the system. On exit the
107 futexes address, the number of contentions, and the average time for
108 each contention on the futex are printed from lowest pid number to
109 highest.
110
111
112= NETWORK =
113
114network/nettop.stp - Periodic Listing of Processes Using Network Interfaces
115subsystems: network, keywords: network traffic per-process
116
117 Every five seconds the nettop.stp script prints out a list of
118 processed (PID and command) with the number of packets sent/received
119 and the amount of data sent/received by the process during that
120 interval.
121
122
123network/socket-trace.stp - Trace Functions called in Network Socket Code
124subsystems: network, keywords: network socket
125
126 The script instrument each of the functions inn the Linux kernel's
127 net/socket.c file. The script prints out trace. The first element of
128 a line is time delta in microseconds from the previous entry. This
129 is followed by the command name and the PID. The "->" and "<-"
130 indicates function entry and function exit, respectively. The last
131 element of the line is the function name.
132
133
134= NONE =
135
136general/helloworld.stp - SystemTap "Hello World" Program
137subsystems: none, keywords: simple
138
139 A basic "Hello World" program implemented in SystemTap script. It
140 prints out "hello world" message and then immediately exits.
141
142
143= SCHEDULER =
144
145process/sleepingBeauties.stp - Generating Backtraces of Threads Waiting for IO Operations
146subsystems: scheduler, keywords: io scheduler
147
148 The script monitor time threads spend waiting for IO operations (in
149 "D" state) in the wait_for_completion function. If a thread spends
150 over 10ms wall-clock time waiting, information is printed out
151 describing the thread number and executable name. When slow the
152 wait_for_completion function complete, backtraces for the long
153 duration calls are printed out.
154
155
156= SIGNALS =
157
158process/sig_by_pid.stp - Signal Counts by Process ID
159subsystems: signals, keywords: signals
160
161 Print signal counts by process ID in descending order.
162
163
164process/sig_by_proc.stp - Signal Counts by Process Name
165subsystems: signals, keywords: signals
166
167 Print signal counts by process name in descending order.
168
169
170process/sigkill.stp - Track SIGKILL Signals
171subsystems: signals, keywords: signals
172
173 The script traces any SIGKILL signals. When that SIGKILL signal is
174 sent to a process, the script prints out the signal name, the
175 desination executable and process ID, the executable name user ID
176 that sent the signal.
177
178
179process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
180subsystems: signals, keywords: signals
181
182 The script watches for a particular signal sent to a specific
183 process. When that signal is sent to the specified process, the
184 script prints out the PID and executable of the process sending the
185 signal, the PID and executable name of the process receiving the
186 signal, and the signal number and name.
187
188
189= SYSCALL =
190
191io/iotime.stp - Trace Time Spent in Read and Write for Files
192subsystems: syscall, keywords: syscall read write time io
193
194 The script watches each open, close, read, and write syscalls on the
195 system. For each file the scripts observes opened it accumulates the
196 amount of wall clock time spend in read and write operations and the
197 number of bytes read and written. When a file is closed the script
198 prints out a pair of lines for the file. Both lines begin with a
199 timestamp in microseconds, the PID number, and the executable name in
200 parenthesese. The first line with the "access" keyword lists the file
201 name, the attempted number of bytes for the read and write
202 operations. The second line with the "iotime" keyword list the file
203 name and the number of microseconds accumulated in the read and write
204 syscalls.
205
206
207process/sleeptime.stp - Trace Time Spent in nanosleep Syscalls
208subsystems: syscall, keywords: syscall sleep
209
210 The script watches each nanosleep syscall on the system. At the end
211 of each nanosleep syscall the script prints out a line with a
212 timestamp in microseconds, the pid, the executable name in
213 paretheses, the "nanosleep:" key, and the duration of the sleep in
214 microseconds.
215
216
217process/syscalls_by_pid.stp - System-Wide Count of Syscalls by PID
218subsystems: syscall, keywords: syscall
219
220 The script watches all syscall on the system. On exit the script
221 prints a list showing the number of systemcalls executed by each PID
222 ordered from greatest to least number of syscalls.
223
224
225process/syscalls_by_proc.stp - System-Wide Count of Syscalls by Executable
226subsystems: syscall, keywords: syscall
227
228 The script watches all syscall on the system. On exit the script
229 prints a list showing the number of systemcalls executed by each
230 executable ordered from greates to least number of syscalls.
231
232
233process/wait4time.stp - Trace Time Spent in wait4 Syscalls
234subsystems: syscall, keywords: syscall wait4
235
236 The script watches each wait4 syscall on the system. At the end of
237 each wait4 syscall the script prints out a line with a timestamp in
238 microseconds, the pid, the executable name in paretheses, the
239 "wait4:" key, the duration of the wait and the PID that the wait4 was
240 waiting for. If the waited for PID is not specified , it is "-1".
241
242
diff --git a/examples/systemtap.css b/examples/systemtap.css
deleted file mode 100644
index 445d95f4..00000000
--- a/examples/systemtap.css
+++ /dev/null
@@ -1,164 +0,0 @@
1body {
2 background-color: #cccccc;
3}
4
5.topnavright {
6 color: #787878;
7 text-align: right;
8 font-family: verdana, Geneva, Arial, Helvetica, sans-serif;
9 font-size: 14px;
10 margin-right: 10px;
11}
12
13.topnavright a:link {
14 text-decoration: none;
15 color: #944E0F;
16}
17
18.topnavright a:visited {
19 text-decoration: none;
20 color: #944E0F;
21}
22
23div.mainbackground {
24 background-color: #ffffff;
25 padding: 17 17 17 17;
26}
27
28div.maintextregion {
29 background-color: #5b5b5b;
30 color: #ffffff;
31}
32
33div.maintextregion h1 {
34 color: #F38019;
35 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
36 font-size: 28px
37}
38
39div.maintextregion h2 {
40 color: #F38019;
41 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
42 margin-bottom: 2px;
43 font-size: 18px;
44 margin-top: 28px;
45}
46
47div.maintextregion h4 {
48 color: #ffffff;
49 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
50 font-weight: bold;
51}
52
53div.maintextregion p {
54 color: #ffffff;
55 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
56 font-size: 14px;
57 line-height: 150%;
58 text-align: justify;
59}
60
61div.maintextregion ul {
62 color: #ffffff;
63 list-style-type: square;
64 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
65 font-size: 14px;
66 line-height: 150%;
67 text-align: justify;
68}
69
70div.maintextregion td ul ul {
71 color: #ffffff;
72 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
73}
74
75div.maintextregion dt {
76 color: #ffffff;
77 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
78 margin-top: 10px;
79}
80
81div.maintextregion pre {
82 color: #ffffff;
83 font-size: 14px;
84}
85
86div.maintextregion td pre {
87 color: #ffffff;
88 font-size: 14px;
89}
90
91div.maintextregion dd {
92 color: #ffffff;
93 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
94 font-size: 14px;
95 line-height: 150%;
96 text-align: justify;
97 margin-left: 10px;
98}
99
100div.maintextregion table {
101 margin-top: 20;
102}
103
104div.maintextregion th {
105 color: #ffffff;
106 background-color: #494949;
107 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
108 text-align: left;
109}
110
111div.maintextregion tr.odd {
112 color: #ffffff;
113 background-color: #393939;
114 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
115}
116
117div.maintextregion tr.even {
118 color: #ffffff;
119 background-color: #4d4d4d;
120 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
121}
122
123div.maintextregion form {
124 color: #ffffff;
125 background-color: #4d4d4d;
126 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
127 border: thin solid #424242;
128 padding: 6;
129}
130
131div.maintextregion dd.left {
132 color: #ffffff;
133 margin-left: 0;
134}
135
136a:link {
137 color: #ff9600;
138 text-decoration: none;
139 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
140}
141
142a:visited {
143 color: #ff9600;
144 text-decoration: none;
145 font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
146}
147
148.imgholder {
149 text-align: center;
150 padding: 8;
151}
152.footer a:link {
153 text-decoration: none;
154 color: #944E0F;
155 font-size: 12px;
156 font-weight: bold;
157}
158.footer a:visited {
159 text-decoration: none;
160 color: #944E0F;
161 font-size: 12px;
162 font-weight: bold;
163}
164
diff --git a/examples/systemtapcorner.gif b/examples/systemtapcorner.gif
deleted file mode 100644
index c44f2c75..00000000
--- a/examples/systemtapcorner.gif
+++ /dev/null
Binary files differ
diff --git a/examples/systemtaplogo.png b/examples/systemtaplogo.png
deleted file mode 100644
index c223babd..00000000
--- a/examples/systemtaplogo.png
+++ /dev/null
Binary files differ