dcsnoop.bt(8)
π dcsnoop.bt(8) β¨ System Manager's Manual π
π NAME
okay so dcsnoop.bt is the tool that traces directory entry cache (dcache) lookups π It's built on bpftrace/eBPF, so it's giving low-level kernel detective vibes ππ¦
πΈ SYNOPSIS
dcsnoop.bt
β¨ DESCRIPTION
bestie, by default this traces every dcache lookup π and shows you which process did the lookup and what filename it asked for ππ
the output can get super verbose π so it's meant for digging deeper into dcache performance beyond what dcstat(8) shows you. dcstat is the one that prints per-second summaries, so think of it as the big-picture friend and dcsnoop as the one who goes full detective mode π΅οΈββοΈ
this uses kernel dynamic tracing of the d_lookup() function. ngl that means it's tied to that function, so it will need updating whenever that function changes π§
and since this runs on BPF, only the root user can use it. no cap, you need to be root π
π§ REQUIREMENTS
you'll need CONFIG_BPF and bcc ready to go π
π EXAMPLES
Trace all dcache lookups:
# dcsnoop.bt
π¦ FIELDS
TIME(ms)β the time of the lookup, in milliseconds β°PIDβ the process ID πCOMMβ the process name π·οΈTβ the type: R means reference, M means miss π a miss prints two lines, one for the reference and one for the miss, so don't panic when you see double πFILEβ the file name component being looked up π this can include trailing pathname components (anything after a/), and those become the subject of later lookups, so it's like a chain of lookups bestie π
π₯ OVERHEAD
okay this part is important, so listen up π file name lookups can be super frequent depending on the workload π this tool prints a line for every failed lookup, and if you add -a, it prints every reference too π± the output can be verbose, and the overhead, even though it's optimized to some extent, can go anywhere from noticeable to significant π
so this is really only for deeper investigations past what dcstat(8) gives you, and only when you absolutely need it π«Ά measure and quantify the overhead in a test environment before using it. trust me on this one π
β οΈ seriously, don't just run this on prod and hope for the best. test it first!
π SOURCE
this comes from bpftrace π
https://github.com/bpftrace/bpftrace
also look in the bpftrace distribution for a companion _examples.txt file. it has example usage, output, and commentary for this tool, which is lowkey a must-read π
this is the bpftrace version of the bcc tool with the same name. the bcc tool might have more options and customizations if you need extra power πͺ
https://github.com/iovisor/bcc
π₯οΈ OS
Linux π§
π§ STABILITY
Unstable - in development. so it's still a work in progress, be gentle with it π₯Ί
π AUTHOR
written by Brendan Gregg π
π«§ SEE ALSO
dcstat(8)π
ok bestie that's the whole thing π β¨ this page is from the USER COMMANDS section, dated 2018-09-08, and it's all about dcsnoop.bt(8) πΈ stay curious and stay iconic π¦π
π¦ where this page comes from
- alpine 3.24: bpftrace-tools-doc 0.26.1-r0 Β· Apache-2.0
- arch rolling: bpftrace 0.27.0-2 Β· Apache-2.0
- centos-stream 10: bpftrace 0.26.1-1.el10 Β· Apache-2.0
- centos-stream 9: bpftrace 0.26.1-1.el9 Β· ASL 2.0
- debian trixie: bpftrace 0.23.2-1 Β· Apache-2.0
- fedora 43: bpftrace 0.24.0-1.fc43 Β· Apache-2.0
- fedora 43: bpftrace 0.24.2-1.fc43 Β· Apache-2.0
- fedora 44: bpftrace 0.24.2-3.fc44 Β· Apache-2.0
- nixos 26.05: bpftrace 0.25.1
- nixpkgs unstable: bpftrace 0.27.1
- opensuse-leap 16.0: bpftrace-tools 0.23.5-160000.1.2 Β· Apache-2.0
- ubuntu questing: bpftrace 0.23.5-1ubuntu1 Β· Apache-2.0
- ubuntu resolute: bpftrace 0.25.0-1ubuntu1 Β· Apache-2.0
- ubuntu stonking: bpftrace 0.25.0-1ubuntu2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms