此内容没有您所选择的语言版本。
4.2.2. Tracking I/O Time For Each File Read or Write
This section describes how to monitor the amount of time it takes for each process to read from or write to any file. This is useful if you wish to determine what files are slow to load on a given system.
iotime.stp
iotime.stp tracks each time a system call opens, closes, reads from, and writes to a file. For each file any system call accesses, iotime.stp counts the number of microseconds it takes for any reads or writes to finish and tracks the amount of data (in bytes) read from or written to the file.
iotime.stp also uses the local variable
$count
to track the amount of data (in bytes) that any system call attempts to read or write. Note that $return
(as used in disktop.stp from Section 4.2.1, “Summarizing Disk Read/Write Traffic”) stores the actual amount of data read/written. $count
can only be used on probes that track data reads or writes (for example syscall.read
and syscall.write
).
Example 4.6. iotime.stp Sample Output
Example 4.6, “iotime.stp Sample Output” prints out the following data:
- A timestamp, in microseconds.
- Process ID and process name.
- An
access
oriotime
flag. - The file accessed.
If a process was able to read or write any data, a pair of
access
and iotime
lines should appear together. The access
line's timestamp refers to the time that a given process started accessing a file; at the end of the line, it will show the amount of data read/written (in bytes). The iotime
line will show the amount of time (in microseconds) that the process took in order to perform the read or write.
If an
access
line is not followed by an iotime
line, it simply means that the process did not read or write any data.