gethostlatency.bt(8)
β¨ gethostlatency.bt(8) β bestie edition β¨
okay so this is a page from the System Manager's Manual and the star of the show is gethostlatency.bt β say hi π
πΈ NAME πΈ
gethostlatency.bt β shows you the latency for getaddrinfo / gethostbyname[2] calls. it runs on bpftrace / eBPF, no cap π
π SYNOPSIS π
gethostlatency.bt
that's it. that's the whole vibe. no flags, no drama, just run it π¦
π DESCRIPTION π
so what this cutie does is trace and print every time gethostbyaddr(), getaddrinfo(), gethostbyname(), and gethostbyname2() get called β system wide β and then it tells you:
- the responsible PID and command name π
- the latency of the call (duration) in milliseconds β±οΈ
- and the host string π
it's giving DNS detective energy fr fr π
this tool is lowkey iconic for identifying DNS latency β like, it shows you which remote host name lookups were slow, and by how much. obsessed.
β οΈ heads up bestie: this tool currently uses dynamic tracing of user-level functions and registers, so it may need modifications to match your software and processor architecture. it's not one-size-fits-all, okay? π
π and since this uses BPF, only the root user can use this tool. root access only, periodt.
π REQUIREMENTS π
CONFIG_BPFbcc
that's the whole shopping list ποΈ
β EXAMPLES β
trace host lookups (getaddrinfo / gethostbyname[2]) system wide:
# gethostlatency.bt
and that's it, she's running π«
π FIELDS π
TIMEβ time of the command, inHH:MM:SSformat πPIDβ process ID of the client performing the call πCOMMβ process (command) name of the client performing the call π·οΈLATmsβ latency of the call, in milliseconds β±οΈHOSTβ host name string: the target of the lookup π―
π§ OVERHEAD π§
the rate of lookups should be relatively low, so the overhead is not expected to be a problem. breathe, bestie, it's fine πβ¨
π SOURCE π
this is from bpftrace π¦
https://github.com/bpftrace/bpftrace
also β go look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool πβ¨
and for the lore: this is a bpftrace version of the bcc tool of the same name. the bcc tool provides command line options π
https://github.com/iovisor/bcc
πΈ OS πΈ
Linux π§ (of course)
π STABILITY π
Unstable β in development. she's still growing, give her grace π
π AUTHOR π
Brendan Gregg β the icon, the legend, the moment β
π«Ά SEE ALSO π«Ά
go read those too, iykyk π
and that's the whole page!! this was filed under USER COMMANDS, dated 2018-09-08, and it's the gethostlatency.bt(8) page in case you forgot where you were π mwah, go trace some lookups bestie πβ¨π¦
π¦ where this page comes from
- alpine 3.24: bpftrace-tools-doc 0.26.1-r0 Β· Apache-2.0
- arch rolling: bpftrace 0.27.0-2 Β· Apache-2.0
- centos-stream 10: bpftrace 0.26.1-1.el10 Β· Apache-2.0
- centos-stream 9: bpftrace 0.26.1-1.el9 Β· ASL 2.0
- nixos 26.05: bpftrace 0.25.1
- nixpkgs unstable: bpftrace 0.27.1
- ubuntu resolute: bpftrace 0.25.0-1ubuntu1 Β· Apache-2.0
- ubuntu stonking: bpftrace 0.25.0-1ubuntu2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms