-
Notifications
You must be signed in to change notification settings - Fork 289
/
Copy pathtcpwin.bt
executable file
·32 lines (29 loc) · 910 Bytes
/
tcpwin.bt
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
#!/usr/local/bin/bpftrace
/*
* tcpwin - Trace TCP send congestion window parameters.
*
* See BPF Performance Tools, Chapter 10, for an explanation of this tool.
*
* Copyright (c) 2019 Brendan Gregg.
* Licensed under the Apache License, Version 2.0 (the "License").
* This was originally created for the BPF Performance Tools book
* published by Addison Wesley. ISBN-13: 9780136554820
* When copying or porting, include this comment.
*
* 20-Apr-2019 Brendan Gregg Created this.
*/
#include <net/sock.h>
#include <linux/tcp.h>
BEGIN
{
printf("event,sock,time_us,snd_cwnd,snd_ssthresh,sk_sndbuf,");
printf("sk_wmem_queued\n");
}
kprobe:tcp_rcv_established
{
$sock = (struct sock *)arg0;
$tcps = (struct tcp_sock *)arg0; // see tcp_sk()
printf("rcv,0x%llx,%lld,%d,%d,%d,%d\n", arg0, elapsed / 1000,
$tcps->snd_cwnd, $tcps->snd_ssthresh, $sock->sk_sndbuf,
$sock->sk_wmem_queued);
}