summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/process/forktracker.stp
diff options
context:
space:
mode:
authorWilliam Cohen <wcohen@redhat.com>2009-06-19 11:33:29 -0400
committerWilliam Cohen <wcohen@redhat.com>2009-06-19 11:33:29 -0400
commite6b653c8c2e63d54a3b33036130a6d8272680f54 (patch)
tree93379f2e98991bcaf618e5b0086f374fe52c5734 /testsuite/systemtap.examples/process/forktracker.stp
parenteeb77fbbbd6494ec8b4496cb4e12104cb1c0e4e2 (diff)
downloadsystemtap-steved-e6b653c8c2e63d54a3b33036130a6d8272680f54.tar.gz
systemtap-steved-e6b653c8c2e63d54a3b33036130a6d8272680f54.tar.xz
systemtap-steved-e6b653c8c2e63d54a3b33036130a6d8272680f54.zip
Add froktracker.stp example.
Diffstat (limited to 'testsuite/systemtap.examples/process/forktracker.stp')
-rw-r--r--testsuite/systemtap.examples/process/forktracker.stp23
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/process/forktracker.stp b/testsuite/systemtap.examples/process/forktracker.stp
new file mode 100644
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)
+}