diff options
Diffstat (limited to 'testsuite/systemtap.examples/io/disktop.stp')
-rwxr-xr-x | testsuite/systemtap.examples/io/disktop.stp | 25 |
1 files changed, 13 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 |