dcsnoop.bt(8)
π dcsnoop.bt β bestie edition β¨
okay so this is dcsnoop.bt(8), a System Manager's Manual page, and it's literally about tracing directory entry cache (dcache) lookups with bpftrace/eBPF. let's get into it π«Ά
πΈ NAME πΈ
dcsnoop.bt β trace directory entry cache (dcache) lookups. uses bpftrace/eBPF. that's the whole vibe. π
β¨ SYNOPSIS β¨
dcsnoop.bt
that's it. no flags in the synopsis. she's simple, she's iconic, she just runs. π
π DESCRIPTION π
so by default, this traces every single dcache lookup, and shows you the process doing the lookup plus the filename it asked for. no cap. π
the output of this tool can get verbose, and it's intended for further investigations of dcache performance beyond dcstat(8), which prints per-second summaries. so like, dcstat(8) is the vibe check, and dcsnoop.bt is the full deep dive. π
this uses kernel dynamic tracing of the d_lookup() function, and it will need and will need updating to match any changes to this function. π« (yes bestie, that's the actual wording β the function can change and this tool has to keep up.)
since this uses BPF, only the root user can use this tool. sorry bestie, no root, no snoop. π
π REQUIREMENTS π
CONFIG_BPF- and
bcc.
that's the checklist. don't skip it. β
π EXAMPLES π
trace all dcache lookups:
# dcsnoop.bt
that's the one example and honestly it ate. π―
π¦ FIELDS π¦
TIME(ms)β time of lookup, in milliseconds. β±οΈPIDβ process ID.COMMβ process name.Tβ type:R== reference,M== miss. a miss will print two lines, one for the reference and one for the miss. so one miss = double the lines, that's just how she works. πFILEβ the file name component that was being looked up. this contains trailing pathname components (after/), which will be the subject of subsequent lookups. iykyk. π§
π₯ OVERHEAD π₯
file name lookups can be frequent (depending on the workload), and this tool prints a line for each failed lookup, and with -a, each reference as well. so yeah, it can get chatty. π
the output may be verbose, and the incurred overhead, while optimized to some extent, may still be from noticeable to significant. that's the tea. π΅
this is only really intended for deeper investigations beyond dcstat(8), when absolutely necessary. measure and quantify the overhead in a test environment before use. fr fr, test it first. π
β οΈ bestie this can be a lot of output and a lot of overhead β do not just yolo it onto production. test env first, always. π«Ά
π SOURCE π
this is from bpftrace.
https://github.com/iovisor/bpftrace
also look in the bpftrace distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. π
this is a bpftrace version of the bcc tool of the same name. the bcc tool may provide more options and customizations.
https://github.com/iovisor/bcc
β OS β
Linux. periodt. π§
π STABILITY π
Unstable - in development. she's growing, she's evolving, she's in her development era. π±
π AUTHOR π
Brendan Gregg
π SEE ALSO π
okay that's the whole page bestie, you're officially a dcache girlie now. this was dcsnoop.bt(8) from the System Manager's Manual, under the USER COMMANDS section, dated 2018-09-08. slay, go trace some lookups responsibly πβ¨π¦
π¦ where this page comes from
- debian bookworm: bpftrace 0.17.0-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms