ugc(8)
β¨ ugc(8) β System Manager's Manual β¨
π¦ NAME π¦
okay so ugc is the bestie who knows every garbage collection event in a high-level language ποΈβ¨ The tool goes by four names: ugc, javagc, nodegc, pythongc, and rubygc. Its whole job is to trace garbage collection events, aka Trace garbage collection events in high-level languages. π
π SYNOPSIS π
javagc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] pid
nodegc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] pid
pythongc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] pid
rubygc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] pid
ugc [-h] [-v] [-m] [-M MINIMUM] [-F FILTER] [-l {java,node,python,ruby}]
pid
πΈ DESCRIPTION πΈ
okay so this traces garbage collection events as they happen π You get the duration of each one, plus any extra info the language's runtime hands over, like which generation got collected or what kind of GC it was. Main character energy, literally. β¨
This tool runs on USDT probes that are baked into lots of high-level languages, like Java, Node, Python, and Ruby π§ The catch is that your runtime has to be built with these probes turned on. Sometimes that means compiling from source with a USDT-specific flag, like "--enable-dtrace" or "--with-dtrace". Not me being picky, it's just how it works π
π¨ Since this uses BPF, only the root user can use this tool. No sneaking in as a regular user, bestie π
π REQUIREMENTS π
You'll need CONFIG_BPF and bcc. π§
π OPTIONS π
-hβ Pulls up the help text. (This one isn't in the original options list, so I'm leaving it as the synopsis shows it. β¨)-vβ Prints the resulting BPF program so you can debug. Super useful when things go sideways π-mβ Shows times in milliseconds instead of the default microseconds π-M MINIMUMβ Only shows collections that run longer than this threshold. The value is in milliseconds. By default, you get every collection, no filter, full vibes π-F FILTERβ Only shows collections whose text description contains this string. Default is showing all of them. β οΈ Heads up: this filtering happens in user-space, not inside the BPF program. So if you've got thousands of collection events, using this filter won't shrink the amount of data sent from the BPF program to the user-space script. It's giving "filter after the fact" π{java,node,python,ruby}β The language you want to trace πpidβ The process id you want to trace π
π EXAMPLES π
Trace garbage collections in a specific Node process:
# ugc node 148
Trace garbage collections in a specific Java process and print GC times in milliseconds:
# ugc -m java 6004
Trace garbage collections in a specific Java process, and only display them if they're longer than 10ms and have the string "Tenured" in their detailed description:
# ugc -M 10 -F Tenured java 6004
π§ FIELDS π§
STARTβ The start time of the GC, measured in seconds from the beginning of the trace β±οΈTIMEβ How long the garbage collection event took β³DESCRIPTIONβ The runtime's own description of this GC event π
π OVERHEAD π
ngl, the overhead is lowkey tiny. GC events, even when they're frequent, shouldn't cause a big hit when you trace them, because they're still not super common. Even hundreds of GCs per second (which is a very high rate) will still produce a pretty negligible overhead. Iconic. π«Ά
π SOURCE π
This comes from bcc π¦ You can find it at:
https://github.com/iovisor/bcc
Also check the bcc distribution for a companion _example.txt file. It has example usage, output, and commentary for this tool, so it's basically a cheat sheet π
π«§ OS π«§
Linux π§
π STABILITY π
Unstable, still in development π§ Not ready for prime time yet, so keep that in mind π
π AUTHOR π
Sasha Goldshtein π
β¨ SEE ALSO β¨
trace(8), ustat(8), uobjnew(8) π
π Okay bestie, that's the whole tea! This page is from the USER COMMANDS collection, dated 2018-10-09, and it's all about ugc(8) β¨ Go trace some garbage and slay π
π
π¦ where this page comes from
- debian bookworm: bpfcc-tools 0.26.0+ds-1 Β· Apache-2.0
- debian trixie: bpfcc-tools 0.31.0+ds-7 Β· 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