-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns-trace-ubuntu.bt
39 lines (36 loc) · 1.09 KB
/
dns-trace-ubuntu.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
33
34
35
36
37
38
39
usdt::http__server__request {
@host = arg2;
@path = arg5;
@method = arg4;
@startrequest[tid] = nsecs;
time("%H:%M:%S ");
printf("%s %s%s\n", str(@method), str(@host), str(@path));
}
usdt::http__server__response
/@host && @path && @method && @startrequest[tid]/
{
$latms = (nsecs - @startrequest[tid]) / 1000000;
printf("Total Request Time: %6d ms \n", $latms);
delete(@host);
delete(@path);
delete(@method);
delete(@startrequest[tid]);
}
uprobe:/lib/x86_64-linux-gnu/libc.so.6:getaddrinfo,
uprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname,
uprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname2
/@host && @path && @method/
{
@start[tid] = nsecs;
@name[tid] = arg0;
}
uretprobe:/lib/x86_64-linux-gnu/libc.so.6:getaddrinfo,
uretprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname,
uretprobe:/lib/x86_64-linux-gnu/libc.so.6:gethostbyname2
/@start[tid] && @host && @path && @method/
{
$latms = (nsecs - @start[tid]) / 1000000;
printf(" DNS Lookup %s %-6d %6d ms \n", str(@name[tid]), pid, $latms);
delete(@start[tid]);
delete(@name[tid]);
}