I/O Monitoring (By Device) - Red Hat ENTERPRISE LINUX 5.4 - SYSTEMTAP BEGINNERS GUIDE Manual

Hide thumbs Also See for ENTERPRISE LINUX 5.4 - SYSTEMTAP BEGINNERS GUIDE:
Table of Contents

Advertisement

Chapter 4. Useful SystemTap Scripts
pam_timestamp_c r:
staprun r:
snmpd r:
pcscd r:
irqbalance r:
cupsd r:
traceio.stp
Example 4.7.

4.2.4. I/O Monitoring (By Device)

This section describes how to monitor I/O activity on a specific device.
traceio2.stp
#! /usr/bin/env stap
global device_of_interest
probe begin {
/* The following is not the most efficient way to do this.
One could directly put the result of usrdev2kerndev()
into device_of_interest.
the other device functions */
dev = usrdev2kerndev($1)
device_of_interest = MKDEV(MAJOR(dev), MINOR(dev))
}
probe vfs.write, vfs.read
{
if (dev == device_of_interest)
printf ("%s(%d) %s 0x%x\n",
execname(), pid(), probefunc(), dev)
}
traceio2.stp
takes 1 argument: the whole device number. To get this number, use stat -c "0x%D"
directory, where directory is located in the device you wish to monitor.
The 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.
traceio2.stp
The output of
function it is performing (i.e. vfs_read or vfs_write), and the kernel device number.
The following example is an excerpt from the full output of 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.
[...]
synergyc(3722) vfs_read 0x800005
synergyc(3722) vfs_read 0x800005
cupsd(2889) vfs_write 0x800005
cupsd(2889) vfs_write 0x800005
cupsd(2889) vfs_write 0x800005
38
138 KiB w:
0 KiB
51 KiB w:
51 KiB
46 KiB w:
0 KiB
28 KiB w:
0 KiB
27 KiB w:
4 KiB
4 KiB w:
18 KiB
Sample Output
However, want to test out
includes the name and ID of any process performing a read/write, the

Advertisement

Table of Contents
loading

Table of Contents