ugc(8)

πŸ“¦
version 0.36.1 Β· 2 versions
, in centos-stream 10, centos-stream 9

πŸ’… ugc β€” like, the ugc(8) manual page, but make it make sense πŸ’…

okay so bestie, real talk: the manual name here is ugc, and it lives in section 8 of the System Manager's Manual. and honestly? it's giving "one tool to rule them all" energy. let's get into it. ✨


🌸 NAME 🌸

ugc, javagc, nodegc, pythongc, rubygc β€” these bad boys trace garbage collection events in high-level languages. that's it, that's the whole vibe. πŸ—‘οΈβœ¨


πŸŽ€ SYNOPSIS πŸŽ€

like, here's the whole squad of invocations, verbatim, no cap:

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

(yes i know -h is sitting there in the synopsis and the OPTIONS section below never introduces it. not me noticing that. πŸ™ˆ anyway β€” moving on.)


πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it actually do? it traces garbage collection events as they occur β€” literally as they happen β€” and it grabs their duration plus any extra info the language's runtime felt like sharing (think: generation collected, or type of GC). πŸ‘‘

big caveat though, and i need you to hear me on this: this tool relies on USDT probes embedded in many high-level languages, like Java, Node, Python, and Ruby. so you need a runtime instrumented with these probes, and in some cases that means building from source with a USDT-specific flag, such as --enable-dtrace or --with-dtrace. periodt. πŸ’…

and since this uses BPF, only the root user can use this tool. root only. no exceptions. πŸ”₯


⭐ REQUIREMENTS ⭐

  • CONFIG_BPF
  • bcc

that's the list. short, sweet, iconic. πŸ’–


✨ OPTIONS ✨

  • -v β€” prints the resulting BPF program, for debugging purposes. like, the whole program. for debugging. you've been warned. 🫢
  • -m β€” print times in milliseconds. the default is microseconds, so if you're an ms kind of girl, this is your flag. ⏱️
  • -M MINIMUM β€” display only collections that are longer than this threshold. the value is given in milliseconds. the default is to display all collections. ngl this is my fave, it filters out the little baby GCs. 🌸
  • -F FILTER β€” display only collections whose textual description matches (contains) this string. the default is to display all collections. ⚠️ but real talk: the filtering here is performed in user-space, and not as part of the BPF program. which means if you have thousands of collection events, specifying this filter will not reduce the amount of data that has to be transferred from the BPF program to the user-space script. so it's a display filter, not a data filter. iykyk. πŸ’€
  • {java,node,python,ruby} β€” the language to trace. pick your fighter. 🌈
  • pid β€” the process id to trace. you gotta know who you're stalking. πŸ”

πŸ’œ 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 display them only if they are longer than 10ms and have the string "Tenured" in their detailed description:

# ugc -M 10 -F Tenured java 6004

ate. every single one. πŸ‘‘


πŸ“ FIELDS πŸ“

here's what you're actually looking at on screen, bestie:

  • START β€” the start time of the GC, in seconds from the beginning of the trace. πŸ•
  • TIME β€” the duration of the garbage collection event. ⏳
  • DESCRIPTION β€” the runtime-provided description of this garbage collection event. like, the runtime wrote this, not us. 🏷️

🧚 OVERHEAD 🧚

okay, good news: garbage collection events, even if frequent, should not produce a considerable overhead when traced, because they are still not very common. even hundreds of GCs per second (which is a very high rate, fr fr) will still produce a fairly negligible overhead. so you can chill. 😌


πŸ’– SOURCE πŸ’–

this is from bcc.

https://github.com/iovisor/bcc

also β€” look in the bcc distribution for a companion _example.txt file containing example usage, output, and commentary for this tool. it's lowkey free extra content, go read it. πŸ“–


🌟 OS 🌟

Linux 🐧


πŸ‘‘ STABILITY πŸ‘‘

Unstable β€” in development. she's still growing, give her grace. 🫢


🌸 AUTHOR 🌸

Sasha Goldshtein 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

trace(8), ustat(8), uobjnew(8)


πŸ’€ one tiny reminder before you go: root only, BPF required, and -F filters in user-space so it does not save you any data transfer. don't say i didn't warn you. πŸ’…

okay that's the whole page!! and for the sign-off: this was USER COMMANDS edition, dated 2018-10-09, and the page footer says ugc(8) β€” so like, yeah, that's the whole manual, mwah. πŸŽ€βœ¨

πŸ“¦ where this page comes from