working at transport level delay measurement
[p2p-testing-infrastructure.git] / ControlScripts / delay-measurement / hook.stp
1 #!/usr/bin/env stap
2 #
3 # Calin-Andrei Burloiu, 2011, calin.burloiu@gmail.com
4 #
5 # This script is used by SystemTap to hook the moments when TCP system calls 
6 # tcp_sendmsg (net/ipv4/tcp_output.c) and tcp_transmit_skb 
7 # (net/ipv4/tcp_output.c) are called and logs them to the output file.
8 # The output is going to be processed in the handle packets client script.
9 #
10
11 function print_info()
12 {
13         if (pid() == target())
14                 printf("%d %s -> %s\n", gettimeofday_ns(), thread_indent(1), probefunc())
15 }
16
17 probe kernel.function("tcp_sendmsg@net/ipv4/tcp.c")
18 {
19         print_info();
20 }
21
22 probe kernel.function("tcp_transmit_skb@net/ipv4/tcp_output.c")
23 {
24         print_info();
25 }