File: linuxmib.stp

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (114 lines) | stat: -rw-r--r-- 3,718 bytes parent folder | download | duplicates (5)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 *      Copyright (C) 2009 IBM Corp.
 *      Copyright (C) 2010-2017 Red Hat Inc.
 *
 *      This file is part of systemtap, and is free software.  You can
 *      redistribute it and/or modify it under the terms of the GNU General
 *      Public License (GPL); either version 2, or (at your option) any
 *      later version.
 *      
 *      Version 1.0     wilder@us.ibm.com     2009-07-06
 */

global DelayedACKs		/* LINUX_MIB_DELAYEDACKS */
global ListenOverflows		/* LINUX_MIB_LISTENOVERFLOWS */
global ListenDrops		/* LINUX_MIB_LISTENDROPS */
global TCPMemoryPressures	/* LINUX_MIB_TCPMEMORYPRESSURES */

/**
 * probe linuxmib.DelayedACKs - Count of delayed acks
 * @sk: Pointer to the struct sock being acted on
 * @op: Value to be added to the counter (default value of 1)
 *
 * The packet pointed to by @skb is filtered by the function
 * linuxmib_filter_key(). If the packet passes the filter is is
 * counted in the global @DelayedACKs (equivalent to SNMP's MIB
 * LINUX_MIB_DELAYEDACKS)
 */
global indelack_timer
probe linuxmib.DelayedACKs = _linuxmib.DelayedACKs.* {}

probe _linuxmib.DelayedACKs.A = kernel.function("tcp_send_ack")
{
	sk=$sk
	if ( !indelack_timer[sk] ) next
	op=1
	key = linuxmib_filter_key(sk,op);
	if ( key ) DelayedACKs[key] += op;
}

probe _linuxmib.DelayedACKs.B = kernel.function("tcp_delack_timer")
{
	sk=@choose_defined($data,
			   &@container_of($t, "inet_connection_sock",
					  icsk_delack_timer)->icsk_inet->sk)
	indelack_timer[sk]=1
	op=0
}

probe _linuxmib.DelayedACKs.C = kernel.function("tcp_delack_timer").return
{
	sk=@entry(@choose_defined($data,
				  &@container_of($t, "inet_connection_sock",
						 icsk_delack_timer)->icsk_inet->sk))
	indelack_timer[sk]=0;
	op=0
}

/**
 * probe linuxmib.ListenOverflows - Count of times a listen queue overflowed
 * @sk: Pointer to the struct sock being acted on
 * @op: Value to be added to the counter (default value of 1)
 *
 * The packet pointed to by @skb is filtered by the function
 * linuxmib_filter_key(). If the packet passes the filter is is
 * counted in the global @ListenOverflows (equivalent to SNMP's MIB
 * LINUX_MIB_LISTENOVERFLOWS)
 */
probe linuxmib.ListenOverflows=kernel.function("tcp_v4_syn_recv_sock").return
{
	sk = @entry($sk)
	if ( $return ) next
	if ( @entry($sk->sk_ack_backlog) <= @entry($sk->sk_max_ack_backlog) ) next
	op = 1;
	key = linuxmib_filter_key(sk,op);
	if ( key ) ListenOverflows[key] += op;
}

/**
 * probe linuxmib.ListenDrops - Count of times conn request that were dropped
 * @sk: Pointer to the struct sock being acted on
 * @op: Value to be added to the counter (default value of 1)
 *
 * The packet pointed to by @skb is filtered by the function
 * linuxmib_filter_key(). If the packet passes the filter is is
 * counted in the global @ListenDrops (equivalent to SNMP's MIB
 * LINUX_MIB_LISTENDROPS)
 */
probe linuxmib.ListenDrops=kernel.function("tcp_v4_syn_recv_sock").return
{
	sk = @entry($sk)
	if ( $return ) next
	op = 1;
	key = linuxmib_filter_key(sk,op);
	if ( key ) ListenDrops[key] += op;
}

/**
 * probe linuxmib.TCPMemoryPressures - Count of times memory pressure was used
 * @sk: Pointer to the struct sock being acted on
 * @op: Value to be added to the counter (default value of 1)
 *
 * The packet pointed to by @skb is filtered by the function
 * linuxmib_filter_key(). If the packet passes the filter is is
 * counted in the global @TCPMemoryPressures (equivalent to SNMP's MIB
 * LINUX_MIB_TCPMEMORYPRESSURES)
 */
probe linuxmib.TCPMemoryPressures=kernel.function("tcp_enter_memory_pressure")
{
	sk = @choose_defined($sk, 0)
	op = 1;
	if ( $tcp_memory_pressure ) next
	key = linuxmib_filter_key(sk,op);
        if ( key ) TCPMemoryPressures[key] += op;
}