DOKK / manpages / debian 11 / bpfcc-tools / gethostlatency-bpfcc.8.en
gethostlatency(8) System Manager's Manual gethostlatency(8)

gethostlatency - Show latency for getaddrinfo/gethostbyname[2] calls. Uses Linux eBPF/bcc.

gethostlatency

This traces and prints when getaddrinfo(), gethostbyname(), and gethostbyname2() are called, system wide, and shows the responsible PID and command name, latency of the call (duration) in milliseconds, and the host string.

This tool can be useful for identifying DNS latency, by identifying which remote host name lookups were slow, and by how much.

This makes use of a Linux 4.4 feature (bpf_perf_event_output()); for kernels older than 4.4, see the version under tools/old, which uses an older mechanism

This tool currently uses dynamic tracing of user-level functions and registers, and may need modifications to match your software and processor architecture.

Since this uses BPF, only the root user can use this tool.

CONFIG_BPF and bcc.

Trace this process ID only.

# gethostlatency

Time of the command (HH:MM:SS).
Process ID of the client performing the call.
Process (command) name of the client performing the call.
Host name string: the target of the lookup.

The rate of lookups should be relatively low, so the overhead is not expected to be a problem.

This is from bcc.

https://github.com/iovisor/bcc

Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool.

Linux

Unstable - in development.

Brendan Gregg

tcpdump(8)

2016-01-28 USER COMMANDS