tcpretrans.bt(8)
β¨ tcpretrans.bt β the manual page, but make it a group chat β¨
okay bestie, gather round π this is tcpretrans.bt, and it lives in section 8 of the manual (System Manager's Manual, so you know it's the cool sysadmin section π
).
πΈ NAME πΈ
tcpretrans.bt β trace or count TCP retransmits. Uses Linux bpftrace/eBPF. no cap, that's the whole vibe β¨
π¦ SYNOPSIS π¦
tcpretrans.bt
that's it. that's the whole invocation. she's lowkey minimal π
π DESCRIPTION π
So here's the tea, bestie: this thing traces TCP retransmits, and it shows you the address, the port, and the TCP state info, and sometimes the PID β although usually not, because retransmits are usually sent by the kernel on timeouts. so the PID field is giving "we tried" energy π
To keep overhead very low, it only traces the TCP retransmit functions. It does not trace every packet like tcpdump(8) or a packet sniffer would. it's not doing all that. it's doing one job and slaying it π
Optionally β and this part is iconic β it can count retransmits over a user signalled interval to spot potentially dropping network paths the flows are traversing. iykyk, that's your network being shady and this tool catching it in 4K πΈ
This uses dynamic tracing of the kernel tcp_retransmit_skb() and tcp_send_loss_probe() functions, and will need to be updated to match kernel changes to these functions. fr fr, kernel moves, this tool has to move with it π«Ά
β οΈ Since this uses BPF, only the root user can use this tool. not root? not today. sorry bestie π
π REQUIREMENTS π
CONFIG_BPFandbcc.CONFIG_BPFandbpftrace.
both flavors listed, both valid, we don't gatekeep here π
π EXAMPLES π
Trace TCP retransmits:
# tcpretrans.bt
look at her go β¨ that # is doing heavy lifting btw, that's your root prompt, that's the whole point πΈ
π§ FIELDS π§
TIMEβ Time of the call, inHH:MM:SSformat. clock in, bestie β°PIDβ Process ID that was on-CPU. This is less useful than it might sound, as it may usually be0, for the kernel, for timer-based retransmits. yeah. it's giving mostly-zeros πLADDR:LPORTβ Local IP address and local port. your side of the convo πRADDR:RPORTβ Remote IP address and remote port. their side πSTATEβ TCP session state. the situationship status, but for sockets πΈ
π₯ OVERHEAD π₯
Should be negligible: TCP retransmit events should be low (<1000/s), and the low overhead this tool adds to each event should make the cost negligible.
translation: she's lightweight, she's polite, she does not eat your CPU for breakfast π
β SOURCE β
This is from bpftrace:
https://github.com/bpftrace/bpftrace
Also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. yes bestie, there's bonus content π
This is a bpftrace version of the bcc tool of the same name. The bcc tool may provide more options and customizations.
https://github.com/iovisor/bcc
two tools, one name, sibling energy π«Ά
πΈ OS πΈ
Linux. obviously. we been knew π§
π STABILITY π
Unstable β in development. she's growing, she's evolving, she's a work in progress and honestly? relatable π¦
π AUTHOR π
Brendan Gregg, adapted for bpftrace by Dale Hamel. legends only, we stan π
π SEE ALSO π
the whole friend group, go read them too β¨
and that's the page bestie!! this was USER COMMANDS, dated 2018-11-24, and it's the tcpretrans.bt(8) page β go forth and trace those retransmits, mwah π
πβ¨
π¦ 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