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
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- debian bookworm: bpfcc-tools 0.26.0+ds-1 Β· Apache-2.0
- debian trixie: bpfcc-tools 0.31.0+ds-7 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- ubuntu jammy: bpfcc-tools 0.18.0+ds-2 Β· Apache-2.0
- ubuntu noble: bpfcc-tools 0.29.1+ds-1ubuntu7 Β· Apache-2.0
- ubuntu questing: bpfcc-tools 0.31.0+ds-7ubuntu2 Β· Apache-2.0
- ubuntu resolute: bpfcc-tools 0.35.0+ds-1ubuntu2 Β· Apache-2.0
- ubuntu stonking: bpfcc-tools 0.35.0+ds-1ubuntu4 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms