summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/network/dropwatch.stp
diff options
context:
space:
mode:
authorKent Sebastian <ksebasti@redhat.com>2009-04-17 16:21:14 -0400
committerKent Sebastian <ksebasti@redhat.com>2009-04-17 16:21:14 -0400
commit7b3a97413eb1e8fce9ae37db0fc9d0f21d6b8f9a (patch)
tree7f42cf54ca1f2a012731858daa803656ba6eff82 /testsuite/systemtap.examples/network/dropwatch.stp
parent755cdd9b9c502b54324a3c56d8fda7fc1ad1fa88 (diff)
parent7c806934696e39dc9ee488ee00d2ffde18ce1ba0 (diff)
downloadsystemtap-steved-7b3a97413eb1e8fce9ae37db0fc9d0f21d6b8f9a.tar.gz
systemtap-steved-7b3a97413eb1e8fce9ae37db0fc9d0f21d6b8f9a.tar.xz
systemtap-steved-7b3a97413eb1e8fce9ae37db0fc9d0f21d6b8f9a.zip
Merge branch 'master' of git+ssh://sources.redhat.com/git/systemtap
Diffstat (limited to 'testsuite/systemtap.examples/network/dropwatch.stp')
-rwxr-xr-xtestsuite/systemtap.examples/network/dropwatch.stp30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/network/dropwatch.stp b/testsuite/systemtap.examples/network/dropwatch.stp
new file mode 100755
index 00000000..79d50a4e
--- /dev/null
+++ b/testsuite/systemtap.examples/network/dropwatch.stp
@@ -0,0 +1,30 @@
+#! /usr/bin/env stap
+
+############################################################
+# Dropwatch.stp
+# Author: Neil Horman <nhorman@redhat.com>
+# An example script to mimic the behavior of the dropwatch utility
+# http://fedorahosted.org/dropwatch
+############################################################
+
+# Array to hold the list of drop points we find
+global locations
+
+# Note when we turn the monitor on and off
+probe begin { printf("Monitoring for dropped packets\n") }
+probe end { printf("Stopping dropped packet monitor\n") }
+
+# increment a drop counter for every location we drop at
+probe kernel.trace("kfree_skb") { locations[$location] <<< 1 }
+
+# Every 5 seconds report our drop locations
+probe timer.sec(5)
+{
+ printf("\n")
+ foreach (l in locations-) {
+ printf("%d packets dropped at location %p\n",
+ @count(locations[l]), l)
+ }
+ delete locations
+}
+