summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/ChangeLog5
-rwxr-xr-xexamples/sig_count_by_pid.stp42
-rw-r--r--examples/sig_count_by_pid.txt24
-rwxr-xr-xexamples/sig_count_by_proc.stp36
-rw-r--r--examples/sig_count_by_proc.txt20
5 files changed, 127 insertions, 0 deletions
diff --git a/examples/ChangeLog b/examples/ChangeLog
index 5ee73c56..0678f284 100644
--- a/examples/ChangeLog
+++ b/examples/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-29 Mike Mason <mmlnx@us.ibm.com>
+
+ * sig_count_by_pid.stp, sig_count_by_pid.txt,
+ sig_count_by_proc.stp, sig_count_by_proc.txt: Print signal activity
+
2007-04-02 Frank Ch. Eigler <fche@elastic.org>
* socket-trace.stp, small_demos/prof.stp, top.stp: Adapt to
diff --git a/examples/sig_count_by_pid.stp b/examples/sig_count_by_pid.stp
new file mode 100755
index 00000000..a8e8be84
--- /dev/null
+++ b/examples/sig_count_by_pid.stp
@@ -0,0 +1,42 @@
+#! stap
+
+# Copyright (C) 2006 IBM Corp.
+#
+# This file is part of systemtap, and is free software. You can
+# redistribute it and/or modify it under the terms of the GNU General
+# Public License (GPL); either version 2, or (at your option) any
+# later version.
+
+#
+# Print signal counts by process IDs in descending order.
+#
+
+global sigcnt, pid2name, sig2name
+
+probe begin {
+ print("Collecting data... Type Ctrl-C to exit and display results\n")
+}
+
+probe signal.send
+{
+ snd_pid = pid()
+ rcv_pid = sig_pid
+
+ sigcnt[snd_pid, rcv_pid, sig]++
+
+ if (!(snd_pid in pid2name)) pid2name[snd_pid] = execname()
+ if (!(rcv_pid in pid2name)) pid2name[rcv_pid] = pid_name
+ if (!(sig in sig2name)) sig2name[sig] = sig_name
+}
+
+probe end
+{
+ printf("%-8s %-16s %-5s %-16s %-16s %s\n",
+ "SPID", "SENDER", "RPID", "RECEIVER", "SIGNAME", "COUNT")
+
+ foreach ([snd_pid, rcv_pid, sig_num] in sigcnt-) {
+ printf("%-8d %-16s %-5d %-16s %-16s %d\n",
+ snd_pid, pid2name[snd_pid], rcv_pid, pid2name[rcv_pid],
+ sig2name[sig_num], sigcnt[snd_pid, rcv_pid, sig_num])
+ }
+}
diff --git a/examples/sig_count_by_pid.txt b/examples/sig_count_by_pid.txt
new file mode 100644
index 00000000..4d5a84c8
--- /dev/null
+++ b/examples/sig_count_by_pid.txt
@@ -0,0 +1,24 @@
+# stap sig_count_by_pid.stp
+Collecting data... Type Ctrl-C to exit and display results
+^C
+Collecting data... Type Ctrl-C to exit and display results
+SPID SENDER RPID RECEIVER SIGNAME COUNT
+0 swapper 25273 Xvnc SIGALRM 1576
+25273 Xvnc 25273 Xvnc SIGALRM 17
+29219 firefox-bin 25273 Xvnc SIGALRM 12
+0 swapper 2442 automount SIGALRM 12
+26754 xterm 26756 bash SIGWINCH 9
+0 swapper 2199 syslogd SIGALRM 6
+25345 metacity 25273 Xvnc SIGALRM 3
+2791 wclientd 2791 wclientd SIGUSR1 2
+30385 ifconfig 30384 sh SIGCHLD 1
+30384 sh 2802 wcstatusd SIGCHLD 1
+30387 mii-tool 30386 sh SIGCHLD 1
+30386 sh 2802 wcstatusd SIGCHLD 1
+30388 lspci 2802 wcstatusd SIGCHLD 1
+30389 sh 2802 wcstatusd SIGCHLD 1
+30391 ifconfig 25273 Xvnc SIGALRM 1
+30391 ifconfig 30390 sh SIGCHLD 1
+30390 sh 2802 wcstatusd SIGCHLD 1
+30393 mii-tool 30392 sh SIGCHLD 1
+30392 sh 2802 wcstatusd SIGCHLD 1
diff --git a/examples/sig_count_by_proc.stp b/examples/sig_count_by_proc.stp
new file mode 100755
index 00000000..15c31a63
--- /dev/null
+++ b/examples/sig_count_by_proc.stp
@@ -0,0 +1,36 @@
+#! stap
+
+# Copyright (C) 2006 IBM Corp.
+#
+# This file is part of systemtap, and is free software. You can
+# redistribute it and/or modify it under the terms of the GNU General
+# Public License (GPL); either version 2, or (at your option) any
+# later version.
+
+#
+# Print signal counts by process name in descending order.
+#
+
+global sigcnt, pid2name, sig2name
+
+probe begin {
+ print("Collecting data... Type Ctrl-C to exit and display results\n")
+}
+
+probe signal.send
+{
+ sigcnt[execname(), pid_name, sig]++
+
+ if (!(sig in sig2name)) sig2name[sig] = sig_name
+}
+
+probe end
+{
+ printf("%-16s %-16s %-16s %s\n",
+ "SENDER", "RECEIVER", "SIGNAL", "COUNT")
+
+ foreach ([snd_name, rcv_name, sig_num] in sigcnt-)
+ printf("%-16s %-16s %-16s %d\n",
+ snd_name, rcv_name, sig2name[sig_num],
+ sigcnt[snd_name, rcv_name, sig_num])
+}
diff --git a/examples/sig_count_by_proc.txt b/examples/sig_count_by_proc.txt
new file mode 100644
index 00000000..1c9078e6
--- /dev/null
+++ b/examples/sig_count_by_proc.txt
@@ -0,0 +1,20 @@
+# stap sig_count_by_proc.stp
+Collecting data... Type Ctrl-C to exit and display results
+^C
+SENDER RECEIVER SIGNAL COUNT
+swapper Xvnc SIGALRM 448
+sh wcstatusd SIGCHLD 318
+ifconfig sh SIGCHLD 106
+mii-tool sh SIGCHLD 106
+lspci wcstatusd SIGCHLD 106
+automount automount SIGCHLD 14
+swapper automount SIGALRM 13
+swapper syslogd SIGALRM 7
+swapper sendmail SIGALRM 2
+sendmail sendmail SIGCHLD 2
+lspci Xvnc SIGALRM 2
+ifconfig automount SIGALRM 1
+sh Xvnc SIGALRM 1
+xterm staprun SIGINT 1
+xterm stap SIGINT 1
+