diff options
author | David Smith <dsmith@redhat.com> | 2009-05-21 16:57:04 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-05-21 16:57:04 -0500 |
commit | c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b (patch) | |
tree | ab2388afb795ed1a7ead2fbbf8b9d1b368a8231f /testsuite/systemtap.examples/network | |
parent | dd9a3bcbef65bde65491d959e9458bc641924811 (diff) | |
parent | 3863e7999255deeaa7f8f4bba7df893773812537 (diff) | |
download | systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.tar.gz systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.tar.xz systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.zip |
Merge commit 'origin/master' into pr7043
Conflicts:
runtime/print.c
runtime/transport/transport.c
runtime/transport/transport_msgs.h
Diffstat (limited to 'testsuite/systemtap.examples/network')
-rw-r--r-- | testsuite/systemtap.examples/network/dropwatch.meta | 13 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/network/dropwatch.stp | 30 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/network/nettop.stp | 10 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/network/tcp.stp | 13 | ||||
-rw-r--r-- | testsuite/systemtap.examples/network/tcpdumplike.meta | 12 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/network/tcpdumplike.stp | 14 |
6 files changed, 91 insertions, 1 deletions
diff --git a/testsuite/systemtap.examples/network/dropwatch.meta b/testsuite/systemtap.examples/network/dropwatch.meta new file mode 100644 index 00000000..176ba236 --- /dev/null +++ b/testsuite/systemtap.examples/network/dropwatch.meta @@ -0,0 +1,13 @@ +title: Watch Where Socket Buffers are Freed in the Kernel +name: dropwatch.stp +version: 1.0 +author: Neil Horman +keywords: network tracepoint buffer free +subsystem: network +status: production +exit: user-controlled +output: timed +scope: system-wide +description: Every five seconds the dropwatch.stp script lists the number of socket buffers freed at locations in the kernel. +test_check: stap -p4 dropwatch.stp +test_installcheck: stap dropwatch.stp -c "sleep 1" 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 +} + diff --git a/testsuite/systemtap.examples/network/nettop.stp b/testsuite/systemtap.examples/network/nettop.stp index 15b4d62a..e96548f1 100755 --- a/testsuite/systemtap.examples/network/nettop.stp +++ b/testsuite/systemtap.examples/network/nettop.stp @@ -1,6 +1,7 @@ #! /usr/bin/env stap global ifxmit, ifrecv +global ifmerged probe netdev.transmit { @@ -18,7 +19,13 @@ function print_activity() "PID", "UID", "DEV", "XMIT_PK", "RECV_PK", "XMIT_KB", "RECV_KB", "COMMAND") - foreach ([pid, dev, exec, uid] in ifrecv-) { + foreach ([pid, dev, exec, uid] in ifrecv) { + ifmerged[pid, dev, exec, uid] += @count(ifrecv[pid,dev,exec,uid]); + } + foreach ([pid, dev, exec, uid] in ifxmit) { + ifmerged[pid, dev, exec, uid] += @count(ifxmit[pid,dev,exec,uid]); + } + foreach ([pid, dev, exec, uid] in ifmerged-) { n_xmit = @count(ifxmit[pid, dev, exec, uid]) n_recv = @count(ifrecv[pid, dev, exec, uid]) printf("%5d %5d %-7s %7d %7d %7d %7d %-15s\n", @@ -32,6 +39,7 @@ function print_activity() delete ifxmit delete ifrecv + delete ifmerged } probe timer.ms(5000), end, error diff --git a/testsuite/systemtap.examples/network/tcp.stp b/testsuite/systemtap.examples/network/tcp.stp new file mode 100755 index 00000000..01db9d2d --- /dev/null +++ b/testsuite/systemtap.examples/network/tcp.stp @@ -0,0 +1,13 @@ +#! /usr/bin/env stap + +//A simple TCP tapset example + +probe begin { + printf("Expected IP 7.91.205.21 .... %s\n", ip_ntop(123456789)) + printf("Expected IP 58.222.104.177 .... %s\n", ip_ntop(987654321)) + printf("Expected IP 9.3.191.111 ... %s\n", ip_ntop(151240559)) +} + +probe tcp.recvmsg { + printf("received a message from %s on port %d from port %d\n", saddr, dport, sport) +} diff --git a/testsuite/systemtap.examples/network/tcpdumplike.meta b/testsuite/systemtap.examples/network/tcpdumplike.meta new file mode 100644 index 00000000..8fb9fccb --- /dev/null +++ b/testsuite/systemtap.examples/network/tcpdumplike.meta @@ -0,0 +1,12 @@ +title: Dump of Received TCP Packets +name: tcpdumplike.stp +version: 1.0 +author: anonymous +keywords: network traffic +subsystem: network +status: production +exit: user-controlled +output: timed +scope: system-wide +description: The tcpdumplike.stp prints out a line for each TCP packet received. Each line includes the source and destination IP addresses, the source and destination ports, and flags. +test_installcheck: stap tcpdumplike.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/network/tcpdumplike.stp b/testsuite/systemtap.examples/network/tcpdumplike.stp new file mode 100755 index 00000000..de3899d6 --- /dev/null +++ b/testsuite/systemtap.examples/network/tcpdumplike.stp @@ -0,0 +1,14 @@ +#! /usr/bin/env stap + +// A TCP dump like example + +probe begin, timer.s(1) { + printf("-----------------------------------------------------------------\n") + printf(" Source IP Dest IP SPort DPort U A P R S F \n") + printf("-----------------------------------------------------------------\n") +} + +probe tcp.receive { + printf(" %15s %15s %5d %5d %d %d %d %d %d %d\n", + saddr, daddr, sport, dport, urg, ack, psh, rst, syn, fin) +} |