uthreads(8)
π NAME π
uthreads, cthreads, and javathreads are the tools for the job, and they all do one thing: they trace thread creation events in Java or pthreads β¨
π¦ SYNOPSIS π¦
cthreads [-h] [-v] pid
javathreads [-h] [-v] pid
uthreads [-h] [-l {c,java,none}] [-v] pid
π DESCRIPTION π
okay so this bad boy traces thread creation events in Java processes, or pthread creation events in any process π Whenever a thread gets created, it prints out that thread's name or start address. iconic.
π Since this uses BPF, only the root user can run this tool. Not you, not me, only root π
π REQUIREMENTS π
You'll need CONFIG_BPF and bcc. No cap, you need both or it's not happening π«Ά
πΈ OPTIONS πΈ
-l {c,java,none}β pick the language you want to trace.candnoneonly trace pthreads, no matter what runtime the process is actually running π§-vβ prints out the resulting BPF program. This is for debugging, so bring it out when something's acting sus πpidβ the process ID you want to trace π
π§ EXAMPLES π§
Trace Java thread creations:
# uthreads -l java 148
Trace pthread creations:
# uthreads 1802
π FIELDS π
TIMEβ the event's time in seconds, counted from when the trace started β±οΈIDβ the thread's ID. What shows up here depends on the runtime, so it's giving "it depends" πTYPEβ the event type: thread start, thread stop, or pthread event π₯DESCRIPTIONβ the thread's name, or the function name of its start address β¨
π«§ OVERHEAD π«§
Thread start and stop events don't happen all that often, so this tool's overhead is basically nothing. Lowkey iconic π
π SOURCE π
This one comes from bcc, bestie π¦
https://github.com/iovisor/bcc
Also check out the bcc distribution for a companion _example.txt file. It has example usage, output, and commentary for this tool, and it's so worth a look π
π§ OS π§
Linux only π§
π§ STABILITY π§
Unstable, still in development. Be gentle with it π₯Ί
π AUTHOR π
Sasha Goldshtein, the queen who made this β¨
π SEE ALSO π
Okay bestie, that's the whole manual for uthreads(8) from the USER COMMANDS section, dated 2018-10-09 π Now go trace some threads and slay π π«Ά
π¦ where this page comes from
- centos-stream 10: bcc-tools 0.36.1-1.el10 Β· Apache-2.0
- centos-stream 9: bcc-tools 0.36.1-1.el9 Β· ASL 2.0
- fedora 43: bcc-tools 0.35.0-2.fc43 Β· Apache-2.0
- fedora 44: bcc-tools 0.35.0-5.fc44 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms