ugc(8)

πŸ“¦
version 0.35.0 Β· 2 versions
, in debian bookworm, debian trixie, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 πŸ’…πŸŽ€