summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.examples/io/traceio2.stp
blob: 656c38b33e61731560d9bde61d3a1c313b2d14c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.  However, want to test out
      the other device functions */
  dev = usrdev2kerndev($1)
  device_of_interest = MKDEV(MAJOR(dev), MINOR(dev))
}

probe kernel.function ("vfs_write"),
      kernel.function ("vfs_read")
{
        dev_nr = $file->f_path->dentry->d_inode->i_sb->s_dev

        if (dev_nr == device_of_interest)
                printf ("%s(%d) %s 0x%x\n",
		        execname(), pid(), probefunc(), dev_nr)
}