summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/process
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-06-22 11:37:08 -0400
committerDave Brolley <brolley@redhat.com>2009-06-22 11:37:08 -0400
commitd6454850dd3c9d74b700924b56378c4c9ab9fa57 (patch)
tree6665a24339ca689b1156ea7e93d4f93811c3f794 /testsuite/systemtap.examples/process
parentd729143af5242b17645d3f405141918940680894 (diff)
parent4116c576d5654287b0af598aee4a14eb2af73224 (diff)
downloadsystemtap-steved-d6454850dd3c9d74b700924b56378c4c9ab9fa57.tar.gz
systemtap-steved-d6454850dd3c9d74b700924b56378c4c9ab9fa57.tar.xz
systemtap-steved-d6454850dd3c9d74b700924b56378c4c9ab9fa57.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite/systemtap.examples/process')
-rw-r--r--testsuite/systemtap.examples/process/forktracker.meta13
-rwxr-xr-xtestsuite/systemtap.examples/process/forktracker.stp23
2 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/process/forktracker.meta b/testsuite/systemtap.examples/process/forktracker.meta
new file mode 100644
index 00000000..f3ef3709
--- /dev/null
+++ b/testsuite/systemtap.examples/process/forktracker.meta
@@ -0,0 +1,13 @@
+title: Trace Creation of Processes
+name: forktracker.stp
+version: 0.1
+author: Phil Muldoon at Red Hat
+keywords: process scheduler
+subsystem: scheduler
+status: production
+exit: user-controlled
+output: trace
+scope: system-wide
+description: The forktracker.stp script prints out a time-stamped entry showing each fork and exec operation on the machine. This can be useful for determine what process is creating a flurry of short-lived processes.
+test_check: stap -p4 forktracker.stp
+test_installcheck: stap forkracker.stp -c "sleep 1"
diff --git a/testsuite/systemtap.examples/process/forktracker.stp b/testsuite/systemtap.examples/process/forktracker.stp
new file mode 100755
index 00000000..525aa0a5
--- /dev/null
+++ b/testsuite/systemtap.examples/process/forktracker.stp
@@ -0,0 +1,23 @@
+#! /usr/bin/env stap
+#
+# This is a stap script to monitor process creations (fork(), exec()'s).
+# Based off of stap script found: http://picobot.org/wordpress/?p=27
+# With some minor modifications (i.e. timestamping)
+#
+# Usage: stap forktracker.stp
+#
+# Sample output:
+#
+# timestamp: process_name (pid) new_pid
+#
+# Version 0.1
+
+probe kprocess.create {
+ printf("%-25s: %s (%d) created %d\n",
+ ctime(gettimeofday_s()), execname(), pid(), new_pid)
+}
+
+probe kprocess.exec {
+ printf("%-25s: %s (%d) is exec'ing %s\n",
+ ctime(gettimeofday_s()), execname(), pid(), filename)
+}