此内容没有您所选择的语言版本。
4.2. Disk
The following sections showcase scripts that monitor disk and I/O activity.
4.2.1. Summarizing Disk Read/Write Traffic 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
This section describes how to identify which processes are performing the heaviest disk reads/writes to the system.
disktop.stp
disktop.stp outputs the top ten processes responsible for the heaviest reads/writes to disk. Example 4.5, “disktop.stp Sample Output” displays a sample output for this script, and includes the following data per listed process:
UID
— user ID. A user ID of0
refers to the root user.PID
— the ID of the listed process.PPID
— the process ID of the listed process's parent process.CMD
— the name of the listed process.DEVICE
— which storage device the listed process is reading from or writing to.T
— the type of action performed by the listed process;W
refers to write, whileR
refers to read.BYTES
— the amount of data read to or written from disk.
The time and date in the output of disktop.stp is returned by the functions
ctime()
and gettimeofday_s()
. ctime()
derives calendar time in terms of seconds passed since the Unix epoch (January 1, 1970). gettimeofday_s()
counts the actual number of seconds since Unix epoch, which gives a fairly accurate human-readable timestamp for the output.
In this script, the
$return
is a local variable that stores the actual number of bytes each process reads or writes from the virtual file system. $return
can only be used in return probes (for example vfs.read.return
and vfs.read.return
).
Example 4.5. disktop.stp Sample Output