Red Hat Training

A Red Hat training course is available for RHEL 8

41.4. 在使用 SystemTap 的特定设备上监控 I/O 活动

您可以使用 traceio2.stp SystemTap 脚本来监控特定设备的 I/O 活动。

先决条件

流程

  • 运行 traceio2.stp 脚本。
# stap --example traceio2.stp 'argument'

该脚本使用整个设备号作为参数。要找到这个数字,您可以使用:

# stat -c "0x%D" directory

其中 directory 位于要监控的设备中。

输出包含以下内容:

  • 执行读取或写入进程的任何进程的名称和 ID
  • 它正在执行的功能(vfs_readvfs_write
  • 内核设备号

请考虑 # stap traceio2.stp 0x805 的输出

[...]
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
[...]