blob: 49302c620870139ef12d957b9f335435001cef33 [file] [log] [blame]
Brendan Gregg5a06c2c2016-01-28 23:00:00 -08001Demonstrations of gethostlatency, the Linux eBPF/bcc version.
2
3
4This traces host name lookup calls (getaddrinfo(), gethostbyname(), and
5gethostbyname2()), and shows the PID and command performing the lookup, the
6latency (duration) of the call in milliseconds, and the host string:
7
8# ./gethostlatency
9TIME PID COMM LATms HOST
1006:10:24 28011 wget 90.00 www.iovisor.org
1106:10:28 28127 wget 0.00 www.iovisor.org
1206:10:41 28404 wget 9.00 www.netflix.com
1306:10:48 28544 curl 35.00 www.netflix.com.au
1406:11:10 29054 curl 31.00 www.plumgrid.com
1506:11:16 29195 curl 3.00 www.facebook.com
1606:11:25 29404 curl 72.00 foo
1706:11:28 29475 curl 1.00 foo
18
19In this example, the first call to lookup "www.iovisor.org" took 90 ms, and
20the second took 0 ms (cached). The slowest call in this example was to "foo",
21which was an unsuccessful lookup.
Paul Chaignonedca17a2017-01-23 22:43:10 +010022
23
24USAGE message:
25
26# ./gethostlatency -h
27usage: gethostlatency [-h] [-p PID]
28
29Show latency for getaddrinfo/gethostbyname[2] calls
30
31optional arguments:
32 -h, --help show this help message and exit
33 -p PID, --pid PID trace this PID only
34
35examples:
synical6b989db2019-10-13 02:17:44 -040036 ./gethostlatency # time getaddrinfo/gethostbyname[2] calls
Paul Chaignonedca17a2017-01-23 22:43:10 +010037 ./gethostlatency -p 181 # only trace PID 181