Ce contenu n'est pas disponible dans la langue sélectionnée.
4.2. Disk
4.2.1. Summarizing Disk Read/Write Traffic Copier lienLien copié sur presse-papiers!
UID— user ID. A user ID of0refers 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;Wrefers to write, whileRrefers to read.BYTES— the amount of data read to or written from disk.
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.
$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 (e.g. vfs.read.return and vfs.read.return).
Example 4.4. disktop.stp Sample Output
4.2.2. Tracking I/O Time For Each File Read or Write Copier lienLien copié sur presse-papiers!
$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 (e.g. syscall.read and syscall.write).
Example 4.5. iotime.stp Sample Output
- A timestamp, in microseconds
- Process ID and process name
- An
accessoriotimeflag - The file accessed
access and iotime lines should appear together. The access line's timestamp refer 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.
access line is not followed by an iotime line, it simply means that the process did not read or write any data.
4.2.3. Track Cumulative IO Copier lienLien copié sur presse-papiers!
$return, which is also used by disktop.stp from Section 4.2.1, “Summarizing Disk Read/Write Traffic”.
Example 4.6. traceio.stp Sample Output
4.2.4. I/O Monitoring (By Device) Copier lienLien copié sur presse-papiers!
stat -c "0x%D" directory, where directory is located in the device you wish to monitor.
usrdev2kerndev() function converts the whole device number into the format understood by the kernel. The output produced by usrdev2kerndev() is used in conjunction with the MKDEV(), MINOR(), and MAJOR() functions to determine the major and minor numbers of a specific device.
vfs_read or vfs_write), and the kernel device number.
stap traceio2.stp 0x805, where 0x805 is the whole device number of /home. /home resides in /dev/sda5, which is the device we wish to monitor.
Example 4.7. traceio2.stp Sample Output
4.2.5. Monitoring Reads and Writes to a File Copier lienLien copié sur presse-papiers!
- The file's major device number.
- The file's minor device number.
- The file's
inodenumber.
stat -c '%D %i' filename, where filename is an absolute path.
/etc/crontab, run stat -c '%D %i' /etc/crontab first. This gives the following output:
805 1078319
805 1078319
805 is the base-16 (hexadecimal) device number. The lower two digits are the minor device number and the upper digits are the major number. 1078319 is the inode number. To start monitoring /etc/crontab, run stap inodewatch.stp 0x8 0x05 1078319 (The 0x prefixes indicate base-16 values.
vfs_read or vfs_write), the device number (in hex format), and the inode number. Example 4.8, “inodewatch-simple.stp Sample Output” contains the output of stap inodewatch.stp 0x8 0x05 1078319 (when cat /etc/crontab is executed while the script is running) :
Example 4.8. inodewatch-simple.stp Sample Output
cat(16437) vfs_read 0x800005/1078319 cat(16437) vfs_read 0x800005/1078319
cat(16437) vfs_read 0x800005/1078319
cat(16437) vfs_read 0x800005/1078319
4.2.6. Monitoring Changes to File Attributes Copier lienLien copié sur presse-papiers!
inode number as arguments. For more information on how to retrieve this information, refer to Section 4.2.5, “Monitoring Reads and Writes to a File”.
uid()). Example 4.9, “inodewatch2-simple.stp Sample Output” contains shows the output of inodewatch2-simple.stp while monitoring /home/joe/bigfile when user joe executes chmod 777 /home/joe/bigfile and chmod 666 /home/joe/bigfile.
Example 4.9. inodewatch2-simple.stp Sample Output
chmod(17448) inode_setattr 0x800005/6011835 100777 500 chmod(17449) inode_setattr 0x800005/6011835 100666 500
chmod(17448) inode_setattr 0x800005/6011835 100777 500
chmod(17449) inode_setattr 0x800005/6011835 100666 500