dcstat(8)

πŸ“¦ version 0.36.1, in centos-stream 10, centos-stream 9, fedora 43, fedora 44

πŸŽ€ dcstat(8) πŸŽ€

dcstat - Directory entry cache (dcache) stats. Uses Linux eBPF/bcc. ✨


🌸 SYNOPSIS 🌸

dcstat [interval [count]]

πŸ’– DESCRIPTION πŸ’–

okay so the Linux directory entry cache (dcache) is what makes file and directory name lookups feel fast πŸŽοΈπŸ’¨ it's giving performance, no cap. this tool spits out per-second summary stats of how the dcache is doing πŸ“Šβœ¨

this uses kernel dynamic tracing on the kernel functions lookup_fast() and d_lookup() πŸ” and fair warning, those will probably need updating whenever the kernel changes πŸ™ˆ so keep that in mind bestie

⚠️ since this uses BPF, only the root user can run this tool. sorry, not sorry πŸ’…

🧚 REQUIREMENTS 🧚

CONFIG_BPF and bcc. πŸ”§


πŸ“ EXAMPLES πŸ“

Print summaries each second:

# dcstat

Print output every five seconds, three times:

# dcstat 5 3

πŸ“Š FIELDS πŸ“Š

  • REFS/s β€” number of dcache lookups (references) per second. the main character count πŸ‘‘
  • SLOW/s β€” number of dcache lookups that failed the lookup_fast() path and had to run the lookup_slow() path instead 🐒
  • MISS/s β€” number of dcache misses, meaning lookups that failed both the fast and slow paths πŸ’€
  • HIT% β€” percentage of dcache hits out of the total references πŸ’―

πŸ¦‹ OVERHEAD πŸ¦‹

the overhead depends on how often file and directory name lookups happen 🫠 the per-event overhead is low, lowkey, but some apps can do over 100k lookups per second 😭 at that point the low per-event cost starts adding up and could become measurable (over 10% CPU usage) πŸ”₯

πŸ§ͺ measure this in a test environment first, please and thank you.

🌈 SOURCE 🌈

this is from bcc πŸ’œ

https://github.com/iovisor/bcc

also check out the companion _examples.txt file in the bcc distribution. it has example usage, output, and commentary for this tool πŸ“


🐧 OS 🐧

Linux 🐧


πŸ™ˆ STABILITY πŸ™ˆ

Unstable - in development. it's still cooking, so be gentle 🍳


πŸ‘©β€πŸ’» AUTHOR πŸ‘©β€πŸ’»

Brendan Gregg, the legend himself πŸ‘‘πŸ«Ά


πŸ”— SEE ALSO πŸ”—

  • dcsnoop(8) β€” the sibling tool you should check out next πŸ¦‹

Manual page dcstat(8) from USER COMMANDS, dated 2016-02-09, signing off with love πŸ’–βœ¨ bye bestie πŸŽ€πŸ’…

πŸ“¦ where this page comes from