forked from soarpenguin/systemtap-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dropwatch.stp
35 lines (29 loc) · 1.1 KB
/
dropwatch.stp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /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
#
# sudo stap --all-modules dropwatch.stp
############################################################
# Array to hold the list of drop points we find
global locations, loc
# 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 }
probe kfree_skb_1 = kernel.trace("kfree_skb") {loc = $location}
probe kfree_skb_2 = kernel.function("kfree_skb") {loc = return_addr()}
probe kfree_skb_1!, kfree_skb_2 {locations[loc] <<< 1}
# Every 5 seconds report our drop locations
probe timer.sec(5)
{
printf("\n")
foreach (l in locations-) {
printf("%d packets dropped at %s\n",
@count(locations[l]), symname(l))
}
delete locations
}