- tools/[bitesize](tools/bitesize.py): Show per process I/O size histogram. [Examples](tools/bitesize_example.txt).
- tools/[cachestat](tools/cachestat.py): Trace page cache hit/miss ratio. [Examples](tools/cachestat_example.txt).
- tools/[execsnoop](tools/execsnoop.py): Trace new processes via exec() syscalls. [Examples](tools/execsnoop_example.txt).
-- tools/[fsslower](tools/fsslower.py): Trace slow file system synchronous reads and writes. [Examples](tools/fsslower_example.txt).
+- tools/[fileslower](tools/fileslower.py): Trace slow synchronous file reads and writes. [Examples](tools/fileslower_example.txt).
- tools/[funccount](tools/funccount.py): Count kernel function calls. [Examples](tools/funccount_example.txt).
- tools/[funclatency](tools/funclatency.py): Time kernel functions and show their latency distribution. [Examples](tools/funclatency_example.txt).
- tools/[gethostlatency](tools/gethostlatency.py): Show latency for getaddrinfo/gethostbyname[2] calls. [Examples](tools/gethostlatency_example.txt).
-.TH fsslower 8 "2016-02-07" "USER COMMANDS"
+.TH fileslower 8 "2016-02-07" "USER COMMANDS"
.SH NAME
-fsslower \- Summarize block device I/O latency as a histogram.
+fileslower \- Trace slow synchronous file reads and writes.
.SH SYNOPSIS
-.B fsslower [\-h] [\-p PID] [min_ms]
+.B fileslower [\-h] [\-p PID] [min_ms]
.SH DESCRIPTION
This script uses kernel dynamic tracing of synchronous reads and writes
-at the VFS interface, to identify slow file system I/O for any file system.
+at the VFS interface, to identify slow file reads and writes for any file
+system.
This version traces __vfs_read() and __vfs_write() and only showing
synchronous I/O (the path to new_sync_read() and new_sync_write()), and
I/O with filenames. This approach provides a view of just two file
-system request types: reads and writes. There are typically many others:
+system request types: file reads and writes. There are typically many others:
asynchronous I/O, directory operations, file handle operations, file open()s,
-fflush(), etc, that this tool does not currently instrument. This
-implementation is a work around until we have suitable fs tracepoints.
+fflush(), etc.
WARNING: See the OVERHEAD section.
Minimum I/O latency (duration) to trace, in milliseconds. Default is 10 ms.
.SH EXAMPLES
.TP
-Trace synchronous file system reads and writes slower than 10 ms:
+Trace synchronous file reads and writes slower than 10 ms:
#
-.B fsslower
+.B fileslower
.TP
Trace slower than 1 ms:
#
-.B fsslower 1
+.B fileslower 1
.TP
Trace slower than 1 ms, for PID 181 only:
#
-.B fsslower \-p 181 1
+.B fileslower \-p 181 1
.SH FIELDS
.TP
TIME(s)
.PP
# ./funccount.py -i 1 -r '^__vfs_(read|write)$'
.PP
-This also costs overhead, but is somewhat less than fsslower.
+This also costs overhead, but is somewhat less than fileslower.
.PP
If the overhead is prohibitive for your workload, I'd recommend moving
down-stack a little from VFS into the file system functions (ext4, xfs, etc).
Look for updates to bcc for specific file system tools that do this. The
advantage of a per-file system approach is that we can trace post-cache,
-greatly reducing events and overhead. The disadvantage is needing custom
+greatly reducing events and overhead. The disadvantage is needing custom
tracing approaches for each different file system (whereas VFS is generic).
.SH SOURCE
This is from bcc.
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
-# fsslower Trace slow file system synchronous reads and writes.
-# For Linux, uses BCC, eBPF.
+# fileslower Trace slow synchronous file reads and writes.
+# For Linux, uses BCC, eBPF.
#
-# USAGE: fsslower [-h] [-p PID] [min_ms]
+# USAGE: fileslower [-h] [-p PID] [min_ms]
#
# This script uses kernel dynamic tracing of synchronous reads and writes
-# at the VFS interface, to identify slow file system I/O for any file system.
+# at the VFS interface, to identify slow file reads and writes for any file
+# system.
#
# This works by tracing __vfs_read() and __vfs_write(), and filtering for
# synchronous I/O (the path to new_sync_read() and new_sync_write()), and
# for I/O with filenames. This approach provides a view of just two file
# system request types. There are typically many others: asynchronous I/O,
# directory operations, file handle operations, etc, that this tool does not
-# instrument. This implementation is a work around until we have suitable fs
-# tracepoints.
+# instrument.
#
# WARNING: This traces VFS reads and writes, which can be extremely frequent,
# and so the overhead of this tool can become severe depending on the
# arguments
examples = """examples:
- ./fsslower # trace sync I/O slower than 10 ms (default)
- ./fsslower 1 # trace sync I/O slower than 1 ms
- ./fsslower -p 185 # trace PID 185 only
+ ./fileslower # trace sync file I/O slower than 10 ms (default)
+ ./fileslower 1 # trace sync file I/O slower than 1 ms
+ ./fileslower -p 185 # trace PID 185 only
"""
parser = argparse.ArgumentParser(
- description="Trace slow file system sync reads and writes",
+ description="Trace slow synchronous file reads and writes",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=examples)
parser.add_argument("-p", "--pid",
-Demonstrations of fsslower, the Linux eBPF/bcc version.
+Demonstrations of fileslower, the Linux eBPF/bcc version.
-fsslower shows file-based synchronous reads and writes slower than a threshold.
-For example:
+fileslower shows file-based synchronous reads and writes slower than a
+threshold. For example:
-# ./fsslower
+# ./fileslower
Tracing sync read/writes slower than 10 ms
TIME(s) COMM PID D BYTES LAT(ms) FILENAME
0.000 randread.pl 4762 R 8192 12.70 data1
is a better measure of the latency suffered by applications reading from the
file system than measuring this down at the block device interface.
-Note that this only traces reads and writes: other file system operations
-(eg, directory operations, open(), fflush()) are not currently traced.
+Note that this only traces file reads and writes: other file system operations
+(eg, directory operations, open(), fflush()) are not traced.
The threshold can be provided as an argument. Eg, I/O slower than 1 ms:
-# ./fsslower 1
+# ./fileslower 1
Tracing sync read/writes slower than 1 ms
TIME(s) COMM PID D BYTES LAT(ms) FILENAME
0.000 randread.pl 6925 R 8192 1.06 data1
In the following example, the file system caches were dropped before running
-fsslower, and then in another session a "man ls" was executed. The command
+fileslower, and then in another session a "man ls" was executed. The command
and files read from disk can be seen:
-# echo 3 > /proc/sys/vm/drop_caches; ./fsslower 1
+# echo 3 > /proc/sys/vm/drop_caches; ./fileslower 1
Tracing sync read/writes slower than 1 ms
TIME(s) COMM PID D BYTES LAT(ms) FILENAME
0.000 bash 9647 R 128 5.83 man
USAGE message:
-# ./fsslower -h
-usage: fsslower [-h] [-p PID] [min_ms]
+# ./fileslower -h
+usage: fileslower [-h] [-p PID] [min_ms]
-Trace slow file system sync reads and writes
+Trace slow synchronous file reads and writes
positional arguments:
min_ms minimum I/O duration to trace, in ms (default 10)
-p PID, --pid PID trace this PID only
examples:
- ./fsslower # trace sync I/O slower than 10 ms (default)
- ./fsslower 1 # trace sync I/O slower than 1 ms
- ./fsslower -p 185 # trace PID 185 only
+ ./fileslower # trace sync file I/O slower than 10 ms (default)
+ ./fileslower 1 # trace sync file I/O slower than 1 ms
+ ./fileslower -p 185 # trace PID 185 only