diff options
author | William Cohen <wcohen@redhat.com> | 2009-04-17 15:41:48 -0400 |
---|---|---|
committer | William Cohen <wcohen@redhat.com> | 2009-04-17 15:41:48 -0400 |
commit | 0e4901b0e6524c4ed5f9b5f3ab0f2a1d1dbd86d6 (patch) | |
tree | 5bb032b5fd94e0552bf1dc34ffc69c6484d88ef3 /testsuite/systemtap.examples/network/dropwatch.stp | |
parent | 9831040e54178a1b6eb4637213bb3c81f6ed254b (diff) | |
download | systemtap-steved-0e4901b0e6524c4ed5f9b5f3ab0f2a1d1dbd86d6.tar.gz systemtap-steved-0e4901b0e6524c4ed5f9b5f3ab0f2a1d1dbd86d6.tar.xz systemtap-steved-0e4901b0e6524c4ed5f9b5f3ab0f2a1d1dbd86d6.zip |
Add dropwatch.stp example.
Diffstat (limited to 'testsuite/systemtap.examples/network/dropwatch.stp')
-rw-r--r-- | testsuite/systemtap.examples/network/dropwatch.stp | 30 |
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 100644 index 00000000..bba7ecd2 --- /dev/null +++ b/testsuite/systemtap.examples/network/dropwatch.stp @@ -0,0 +1,30 @@ +#!/usr/bin/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 +} + |