Add FoundationDB stuff
[slow/toolbox.git] / tcp_tput.d
1 #!/usr/sbin/dtrace -s
2
3 #pragma D option quiet
4
5 /* from https://blogs.oracle.com/amaguire/entry/exploring_tcp_throughput_with_dtrace */
6
7 tcp:::receive
8 / (args[4]->tcp_flags & (TH_SYN|TH_RST|TH_FIN)) == 0 && args[4]->tcp_dport == 548 /
9 {
10         @swnd[args[2]->ip_saddr] =
11             quantize((args[4]->tcp_window)*(1 << args[3]->tcps_snd_ws));
12
13 }
14
15 tcp:::send
16 / (args[4]->tcp_flags & (TH_SYN|TH_RST|TH_FIN)) == 0 && args[4]->tcp_sport == 548 /
17 {
18         @unacked[args[2]->ip_daddr] =
19             quantize(args[3]->tcps_snxt - args[3]->tcps_suna);
20 }
21
22 dtrace:::END
23 {
24         printf("TCP Send Window Size (bytes)\n");
25         printf("===============================\n");
26         printa(@swnd);
27
28         printf("Unackknowleged data in flight (bytes)\n");
29         printf("===============================\n");
30         printa(@unacked);
31 }