dirtop(8)
π dirtop(8) π
manual name: dirtop(8), the System Manager's Manual, so it's giving admin-tool energy π
β¨ NAME β¨
dirtop - File reads and writes by directory. Top for directories. π¦
πͺ SYNOPSIS πͺ
dirtop -d directory1,directory2,... [-h] [-C] [-r MAXROWS] [-s {reads,writes,rbytes,wbytes}] [-p PID] [interval] [count]
π DESCRIPTION π
okay so this is literally top for directories πβ¨
It traces file reads and writes and prints a per-directory summary every interval (by default, 1 second). By default the summary is sorted on the highest read throughput (Kbytes), but you can change the sorting order with the -s option. main character energy π
It uses in-kernel eBPF maps to store per-process summaries, so it's efficient. the way that π§
This script works by tracing the __vfs_read() and __vfs_write() functions with kernel dynamic tracing, which instruments explicit read and write calls. ngl, if files get read or written some other way (eg, via mmap()), they will not show up here π Also, this tool will need updating to match any code changes to those VFS functions.
This should be super useful for file system workload characterization when you're analyzing how applications perform π
Heads up bestie: tracing VFS level reads and writes can happen a LOT, so this tool can start costing measurable overhead at high I/O rates π
Since this uses BPF, only the root user can use this tool π₯
π§° REQUIREMENTS π§°
CONFIG_BPF and bcc. iykyk π
ποΈ OPTIONS ποΈ
-dβ give it a comma-separated list of directories to watch. Wildcards work if they're between single brackets πΈ-Cβ don't clear the screen between updates π«Ά-r MAXROWSβ the max number of rows to print. Default is20β¨-s {reads,writes,rbytes,wbytes}β pick the sort column. Default isrbytes(read throughput) π₯-p PIDβ only trace this PID, bestie π―- interval β how long between updates, in seconds β°
- count β how many interval summaries you want before it stops π
πΈ EXAMPLES πΈ
Summarize block device I/O by directory, with a 1 second screen refresh:
# dirtop -d '/hdfs/uuid/*/yarn'
Don't clear the screen, and only show the top 8 rows:
# dirtop -d '/hdfs/uuid/*/yarn' -Cr 8
5 second summaries, 10 times only:
# dirtop -d '/hdfs/uuid/*/yarn' 5 10
Report read & write IOs generated across multiple yarn and data directories:
# dirtop -d '/hdfs/uuid/*/yarn,/hdfs/uuid/*/data'
π·οΈ FIELDS π·οΈ
loadavg:β the contents of/proc/loadavgπREADSβ count of reads during the interval πWRITESβ count of writes during the interval βοΈR_Kbβ total read Kbytes during the interval π§W_Kbβ total write Kbytes during the interval πPATHβ the path where the IOs were accounted ποΈ
πΈ OVERHEAD πΈ
okay real talk, depending on how often the app does reads and writes, the overhead can get significant. In the worst case it can slow applications down by over 50% π Hopefully real-world workloads see way less, but test before you use it. The reason it's so heavy is that VFS reads and writes can be super frequent. Even though the eBPF overhead per event is tiny, multiply that by a million events per second and it becomes a million times worse. Literally. π You can gauge how many reads and writes are happening with the vfsstat(8) tool, also from bcc.
π SOURCE π
This is from bcc:
https://github.com/iovisor/bcc
Also check the bcc distribution for a companion _examples.txt file with example usage, output, and commentary for this tool π
π§ OS π§
Linux π
π§ STABILITY π§
Unstable, it's still in development π οΈ
π©βπ» AUTHOR π©βπ»
Erwan Velu π«Ά
π‘ INSPIRATION π‘
filetop(8) by Brendan Gregg, the OG π
π SEE ALSO π
vfsstat(8), vfscount(8), fileslower(8) π¦
π Filed under user commands, last updated 2020-03-16. Source is bcc, so go check it out, and be safe with that overhead, bestie π π
π¦ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 Β· Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 Β· Apache-2.0
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms