summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/process
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-05-21 16:57:04 -0500
committerDavid Smith <dsmith@redhat.com>2009-05-21 16:57:04 -0500
commitc8e9eb18d8d13d099a4a177fe53de507c1d9ce8b (patch)
treeab2388afb795ed1a7ead2fbbf8b9d1b368a8231f /testsuite/systemtap.examples/process
parentdd9a3bcbef65bde65491d959e9458bc641924811 (diff)
parent3863e7999255deeaa7f8f4bba7df893773812537 (diff)
downloadsystemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.tar.gz
systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.tar.xz
systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.zip
Merge commit 'origin/master' into pr7043
Conflicts: runtime/print.c runtime/transport/transport.c runtime/transport/transport_msgs.h
Diffstat (limited to 'testsuite/systemtap.examples/process')
-rw-r--r--testsuite/systemtap.examples/process/errsnoop.meta7
-rwxr-xr-xtestsuite/systemtap.examples/process/errsnoop.stp44
-rwxr-xr-xtestsuite/systemtap.examples/process/proc_snoop.stp12
-rw-r--r--testsuite/systemtap.examples/process/sigmon.meta4
4 files changed, 59 insertions, 8 deletions
diff --git a/testsuite/systemtap.examples/process/errsnoop.meta b/testsuite/systemtap.examples/process/errsnoop.meta
new file mode 100644
index 00000000..34b8cb7c
--- /dev/null
+++ b/testsuite/systemtap.examples/process/errsnoop.meta
@@ -0,0 +1,7 @@
+title: tabulate system call errors
+name: errsnoop.stp
+keywords: process syscall
+subsystem: general
+description: The script prints a periodic tabular report about failing system calls, by process and by syscall failure. The first optional argument specifies the reporting interval (in seconds, default 5); the second optional argument gives a screen height (number of lines in the report, default 20).
+test_check: stap -p4 errsnoop.stp
+test_installcheck: stap errsnoop.stp 1 10 -c "sleep 3"
diff --git a/testsuite/systemtap.examples/process/errsnoop.stp b/testsuite/systemtap.examples/process/errsnoop.stp
new file mode 100755
index 00000000..a3f17b77
--- /dev/null
+++ b/testsuite/systemtap.examples/process/errsnoop.stp
@@ -0,0 +1,44 @@
+#!/bin/sh
+//usr/bin/env stap -DMAXMAPENTRIES=20480 $0 $@; exit $?
+# errsnoop.stp
+# Copyright (C) 2009 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# attack "stupid userspace" apps
+#
+
+global error, trace
+
+probe syscall.* {
+ # assume syscall don't nest
+ trace[tid()] = argstr
+}
+
+probe syscall.*.return {
+ errno = errno_p(returnval())
+ if (errno != 0) {
+ t = tid()
+ argstr = trace[t]
+ delete trace[t]
+
+ error[name, execname(), pid(), errno, argstr] <<< 1
+ }
+}
+
+probe timer.s(%( $# > 0 %? $1 %: 5 %)) {
+ ansi_clear_screen()
+ printf("%17s %15s %5s %4s %-12s %s\n",
+ "SYSCALL", "PROCESS", "PID", "HITS", "ERRSTR", "ARGSTR")
+ foreach([fn, comm, pid, errno, argstr] in error- limit %( $# > 1 %? $2 %: 20 %)) {
+ errstr = sprintf("%3d (%s)", errno, errno_str(errno))
+ printf("%17s %15s %5d %4d %-12s %s\n", fn, comm, pid,
+ @count(error[fn, comm, pid, errno, argstr]),
+# errstr, substr(argstr,0,22)) # within cols#80
+ errstr, argstr)
+
+ }
+ delete error
+}
diff --git a/testsuite/systemtap.examples/process/proc_snoop.stp b/testsuite/systemtap.examples/process/proc_snoop.stp
index 06425d45..9a3768c2 100755
--- a/testsuite/systemtap.examples/process/proc_snoop.stp
+++ b/testsuite/systemtap.examples/process/proc_snoop.stp
@@ -18,30 +18,30 @@ function id:string(task:long) {
task_execname(task))
}
-probe process.create {
+probe kprocess.create {
report(sprintf("create %s", id(task)))
}
-probe process.start {
+probe kprocess.start {
report("start")
}
-probe process.exec {
+probe kprocess.exec {
report(sprintf("exec %s", filename))
}
-probe process.exec_complete {
+probe kprocess.exec_complete {
if (success)
report("exec success")
else
report(sprintf("exec failed %d (%s)", errno, errno_str(errno)))
}
-probe process.exit {
+probe kprocess.exit {
report(sprintf("exit %d", code))
}
-probe process.release {
+probe kprocess.release {
report(sprintf("remove %s", id(task)))
}
diff --git a/testsuite/systemtap.examples/process/sigmon.meta b/testsuite/systemtap.examples/process/sigmon.meta
index 18834997..fe192248 100644
--- a/testsuite/systemtap.examples/process/sigmon.meta
+++ b/testsuite/systemtap.examples/process/sigmon.meta
@@ -1,5 +1,5 @@
-title: System-Wide Count of Syscalls by PID
-name: syscalls_by_pid.stp
+title: Track a particular signal to a specific process
+name: sigmon.stp
version: 1.0
author: IBM
keywords: signals