• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Demonstrations 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.
22
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:
36    ./gethostlatency           # trace all TCP accept()s
37    ./gethostlatency -p 181    # only trace PID 181
38