-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtcp_mem.stp
55 lines (48 loc) · 1.49 KB
/
tcp_mem.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# show receive/send buffers (rmem, wmem)
# show incoming queue (netdev_backlog)
# sysctl net.ipv4.tcp_rmem
# sysctl net.ipv4.tcp_wmem
# @ton31337
global _rcv;
global _snd;
global _rcv_queue;
function print_head()
{
ansi_clear_screen();
println("Probing...Type CTRL+C to stop probing.");
println("Buffer size\t\tCount\n");
}
probe begin { print_head(); }
probe kernel.function("tcp_v4_do_rcv"), kernel.function("tcp_v6_do_rcv")
{
family = (ppfunc() == "tcp_v4_do_rcv") ? "inet4" : "inet6";
_rcv[family, $sk->sk_rcvbuf]++;
_snd[family, $sk->sk_sndbuf]++;
_rcv_queue[family, cpu()] = $sk->sk_receive_queue->qlen;
}
probe timer.s(2)
{
print_head();
println("# READ");
foreach([family, buf] in _rcv- limit 10) {
printf("%s buffer: %d bytes (%d Kbytes), count: %d\n",
family,
buf,
(buf / 1024),
_rcv[family, buf]);
}
println("\n# WRITE");
foreach([family, buf] in _snd- limit 10) {
printf("%s buffer: %d bytes (%d Kbytes), count: %d\n",
family,
buf,
(buf / 1024),
_snd[family, buf]);
}
println("\n# RECEIVE QUEUES");
foreach([family, cpu] in _rcv_queue- limit 10) {
printf("%s qlen: %d, cpu: %d\n", family, _rcv_queue[family, cpu], cpu);
}
delete _rcv;
delete _snd;
}