From 0e4901b0e6524c4ed5f9b5f3ab0f2a1d1dbd86d6 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Fri, 17 Apr 2009 15:41:48 -0400 Subject: Add dropwatch.stp example. --- .../systemtap.examples/network/dropwatch.meta | 13 ++++++++++ testsuite/systemtap.examples/network/dropwatch.stp | 30 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 testsuite/systemtap.examples/network/dropwatch.meta create mode 100644 testsuite/systemtap.examples/network/dropwatch.stp (limited to 'testsuite/systemtap.examples/network') 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 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 +# 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 +} + -- cgit From 7c806934696e39dc9ee488ee00d2ffde18ce1ba0 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Fri, 17 Apr 2009 15:53:38 -0400 Subject: Make dropwatch.stp executable and have correct interpreter. --- testsuite/systemtap.examples/network/dropwatch.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 testsuite/systemtap.examples/network/dropwatch.stp (limited to 'testsuite/systemtap.examples/network') diff --git a/testsuite/systemtap.examples/network/dropwatch.stp b/testsuite/systemtap.examples/network/dropwatch.stp old mode 100644 new mode 100755 index bba7ecd2..79d50a4e --- a/testsuite/systemtap.examples/network/dropwatch.stp +++ b/testsuite/systemtap.examples/network/dropwatch.stp @@ -1,4 +1,4 @@ -#!/usr/bin/stap +#! /usr/bin/env stap ############################################################ # Dropwatch.stp -- cgit