diff options
author | ddomingo <ddomingo@redhat.com> | 2008-10-28 16:02:01 +1000 |
---|---|---|
committer | ddomingo <ddomingo@redhat.com> | 2008-10-28 16:02:01 +1000 |
commit | ed70d5b028bf8af776380deda5e6a75857c41c28 (patch) | |
tree | 456651dd247da3d1fe13fb20f89d5b59a50f212e /testsuite/systemtap.examples/io | |
parent | 53b9e09f0b30e4f53ec492b345cbd1ab85afe929 (diff) | |
parent | 1a58bf9838378cdab17c2071794a12463007270a (diff) | |
download | systemtap-steved-ed70d5b028bf8af776380deda5e6a75857c41c28.tar.gz systemtap-steved-ed70d5b028bf8af776380deda5e6a75857c41c28.tar.xz systemtap-steved-ed70d5b028bf8af776380deda5e6a75857c41c28.zip |
re-committing all work for today, resolving conflicts earlier
Diffstat (limited to 'testsuite/systemtap.examples/io')
-rwxr-xr-x | testsuite/systemtap.examples/io/disktop.stp | 25 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/traceio2-simple.meta | 13 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/traceio2-simple.stp | 8 |
3 files changed, 34 insertions, 12 deletions
diff --git a/testsuite/systemtap.examples/io/disktop.stp b/testsuite/systemtap.examples/io/disktop.stp index 20462f0a..fcfe79ed 100755 --- a/testsuite/systemtap.examples/io/disktop.stp +++ b/testsuite/systemtap.examples/io/disktop.stp @@ -14,8 +14,11 @@ global io_stat,device global read_bytes,write_bytes -probe vfs.read.return { +probe kernel.function("vfs_read").return { if ($return>0) { + dev = __file_dev($file) + devname = __find_bdevname(dev,__file_bdev($file)) + if (devname!="N/A") {/*skip read from cache*/ io_stat[pid(),execname(),uid(),ppid(),"R"] += $return device[pid(),execname(),uid(),ppid(),"R"] = devname @@ -24,8 +27,11 @@ probe vfs.read.return { } } -probe vfs.write.return { +probe kernel.function("vfs_write").return { if ($return>0) { + dev = __file_dev($file) + devname = __find_bdevname(dev,__file_bdev($file)) + if (devname!="N/A") { /*skip update cache*/ io_stat[pid(),execname(),uid(),ppid(),"W"] += $return device[pid(),execname(),uid(),ppid(),"W"] = devname @@ -37,21 +43,16 @@ probe vfs.write.return { probe timer.ms(5000) { /* skip non-read/write disk */ if (read_bytes+write_bytes) { - printf("\n%-25s, %-8s%4dKb/sec, %-7s%6dKb, %-7s%6dKb\n\n", - ctime(gettimeofday_s()),"Average:", - ((read_bytes+write_bytes)/1024)/5,"Read:", - read_bytes/1024,"Write:",write_bytes/1024) + + printf("\n%-25s, %-8s%4dKb/sec, %-7s%6dKb, %-7s%6dKb\n\n",ctime(gettimeofday_s()),"Average:", + ((read_bytes+write_bytes)/1024)/5,"Read:",read_bytes/1024,"Write:",write_bytes/1024) /* print header */ - printf("%8s %8s %8s %25s %8s %4s %12s\n", - "UID","PID","PPID","CMD","DEVICE","T","BYTES") + printf("%8s %8s %8s %25s %8s %4s %12s\n","UID","PID","PPID","CMD","DEVICE","T","BYTES") } /* print top ten I/O */ foreach ([process,cmd,userid,parent,action] in io_stat- limit 10) - printf("%8d %8d %8d %25s %8s %4s %12d\n", - userid,process,parent,cmd, - device[process,cmd,userid,parent,action], - action,io_stat[process,cmd,userid,parent,action]) + printf("%8d %8d %8d %25s %8s %4s %12d\n",userid,process,parent,cmd,device[process,cmd,userid,parent,action], action,io_stat[process,cmd,userid,parent,action]) /* clear data */ delete io_stat diff --git a/testsuite/systemtap.examples/io/traceio2-simple.meta b/testsuite/systemtap.examples/io/traceio2-simple.meta new file mode 100644 index 00000000..558539e3 --- /dev/null +++ b/testsuite/systemtap.examples/io/traceio2-simple.meta @@ -0,0 +1,13 @@ +title: Watch I/O Activity on a Particular Device Simplified +name: traceio2-simple.stp +version: 1.0 +author: Red Hat +keywords: io +subsystem: io +status: production +exit: user-controlled +output: trace +scope: system-wide +description: Print out the executable name and process number as reads and writes to the specified device occur. +test_check: stap -p4 traceio2.stp 8 5 +test_installcheck: stap traceio2.stp 8 5 -c "sleep 1" diff --git a/testsuite/systemtap.examples/io/traceio2-simple.stp b/testsuite/systemtap.examples/io/traceio2-simple.stp new file mode 100755 index 00000000..ed5efdd1 --- /dev/null +++ b/testsuite/systemtap.examples/io/traceio2-simple.stp @@ -0,0 +1,8 @@ +probe kernel.function ("vfs_write"), +kernel.function ("vfs_read") +{ +dev_nr = $file->f_dentry->d_inode->i_sb->s_dev +inode_nr = $file->f_dentry->d_inode->i_ino +if (dev_nr == ($1 << 20 | $2)) +printf ("%s(%d) %s 0x%x\n", execname(), pid(), probefunc(), dev_nr) +} |